first version
代码更新通知 / update-server (push) Failing after 0s

This commit is contained in:
fghwett committed 2024-12-18 11:23:01 +08:00
commit ea9148395c
9 files changed
+87

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
name: '代码更新通知'
on:
push:
jobs:
update-server:
runs-on: home-lab
steps:
- name: 输出当前目录环境
run: pwd && ls -ahl
- name: 发送通知
id: use-go-action
uses: https://git.aweoo.com/learning/simple-go-action@latest
with:
username: foo
- name: Print Output
run: echo 'output time is ${{ steps.use-go-action.outputs.time }}'
- name: 错误处理
if: ${{ failure() }}
run: |
echo '出错了 你个笨蛋'
+4
View File
@@ -0,0 +1,4 @@
.idea/
_tmp/
out/
dist/
View File
Whitespace-only changes.
+14
View File
@@ -0,0 +1,14 @@
name: 'Simple Go Action'
description: 'A simple Gitea Action written in Go'
inputs:
username:
description: 'The username to print'
required: true
outputs:
time:
description: 'The time when the action was called'
runs:
using: 'go'
main: 'main.go'
pre: 'pre/main.go'
post: 'post/main.go'
+5
View File
@@ -0,0 +1,5 @@
module git.aweoo.com/action/gotify
go 1.23.3
require github.com/sethvargo/go-githubactions v1.3.0 // indirect
+2
View File
@@ -0,0 +1,2 @@
github.com/sethvargo/go-githubactions v1.3.0 h1:Kg633LIUV2IrJsqy2MfveiED/Ouo+H2P0itWS0eLh8A=
github.com/sethvargo/go-githubactions v1.3.0/go.mod h1:7/4WeHgYfSz9U5vwuToCK9KPnELVHAhGtRwLREOQV80=
+27
View File
@@ -0,0 +1,27 @@
package main
import (
"encoding/json"
"fmt"
"github.com/sethvargo/go-githubactions"
"time"
)
func main() {
ctx, err := githubactions.Context()
if err != nil {
panic(err)
}
body, err := json.Marshal(ctx)
if err != nil {
panic(err)
}
fmt.Printf("context: %s\n", string(body))
username := githubactions.GetInput("username")
fmt.Printf("username is %s\n", username)
githubactions.SetOutput("time", time.Now().Format("2006-01-02 15:04:05"))
}
+7
View File
@@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Post of Simple Go Action")
}
+7
View File
@@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Pre of Simple Go Action")
}