workflows

This commit is contained in:
vitaliy 2024-12-21 14:03:54 +03:00
commit f6fc420b53
10 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,10 @@
name: 'Test Go Action'
on: [push]
jobs:
use-go-action:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.20

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# simple-go-action

14
action.yml Normal file
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/pre.go"
post: "post/post.go"

1
gitignore Normal file
View File

@ -0,0 +1 @@
.git

7
go.mod Normal file
View File

@ -0,0 +1,7 @@
module simple-go-action
go 1.20
require github.com/sethvargo/go-githubactions v1.1.0
require github.com/sethvargo/go-envconfig v0.8.0 // indirect

5
go.sum Normal file
View File

@ -0,0 +1,5 @@
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/sethvargo/go-envconfig v0.8.0 h1:AcmdAewSFAc7pQ1Ghz+vhZkilUtxX559QlDuLLiSkdI=
github.com/sethvargo/go-envconfig v0.8.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/sethvargo/go-githubactions v1.1.0 h1:mg03w+b+/s5SMS298/2G6tHv8P0w0VhUFaqL1THIqzY=
github.com/sethvargo/go-githubactions v1.1.0/go.mod h1:qIboSF7yq2Qnaw2WXDsqCReM0Lo1gU4QXUWmhBC3pxE=

15
main.go Normal file
View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
"time"
gha "github.com/sethvargo/go-githubactions"
)
func main() {
username := gha.GetInput("username")
fmt.Printf("username is %s\n", username)
gha.SetOutput("time", time.Now().Format("2006-01-02 15:04:05"))
}

BIN
main.zip Normal file

Binary file not shown.

7
post/post.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Post of Simple Go Action")
}

7
pre/pre.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Pre of Simple Go Action")
}