Skip to content

Commit

Permalink
Use new GH Action in example
Browse files Browse the repository at this point in the history
  • Loading branch information
majori committed Nov 24, 2023
1 parent 7e5bd36 commit a53e590
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
9 changes: 7 additions & 2 deletions cmd/action/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const (
OutputExitCode = "exitcode"
)

var (
// https://goreleaser.com/cookbooks/using-main.version/
version string
)

// This is the entrypoint for the Github Action
func main() {
if os.Getenv("GITHUB_ACTIONS") != "true" {
Expand All @@ -30,13 +35,13 @@ func main() {
out := io.MultiWriter(os.Stdout, output)

// Since arguments are passed as a single string, we need to split them
args, err := shellwords.Split(os.Args[1])
args, err := shellwords.SplitPosix(os.Args[1])
checkErr(err)

delimiter := uuid.Must(uuid.NewV4()).String()
fmt.Fprintf(output, "%s<<%s\n", OutputResult, delimiter)

cmd := cli.NewRootCmd("")
cmd := cli.NewRootCmd(version)
cmd.SetOut(out)
cmd.SetArgs(args)

Expand Down
4 changes: 2 additions & 2 deletions examples/github-action/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: A GitHub Action that checks updates for Jalapeno recipes in the pro
vars:
- name: SCHEDULE
description: Cron expression to determine when the updates should be checked. Defaults to every Monday at 12:00 UTC
default: "0 12 * * 1"
default: 0 12 * * 1
validators:
- pattern: ^(\*|([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\*\/([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\*|([0-9]|1[0-9]|2[0-3])|\*\/([0-9]|1[0-9]|2[0-3])) (\*|([1-9]|1[0-9]|2[0-9]|3[0-1])|\*\/([1-9]|1[0-9]|2[0-9]|3[0-1])) (\*|([1-9]|1[0-2])|\*\/([1-9]|1[0-2])) (\*|([0-6])|\*\/([0-6]))$
help: "Must be a valid cron expression"
help: Must be a valid cron expression
5 changes: 4 additions & 1 deletion examples/github-action/templates/.github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check for Jalapeno recipe updates

on:
workflow_dispatch:
schedule:
- cron: {{ .Variables.SCHEDULE | quote }}

Expand All @@ -17,7 +18,9 @@ jobs:
registry: ghcr.io
username: {{ "${{ github.actor }}" }}
password: {{ "${{ secrets.GITHUB_TOKEN }}" }}
- uses: futurice/jalapeno@v0.1.20
- uses: futurice/jalapeno@main
id: jalapeno
with:
cmd: check
- if: steps.jalapeno.outputs.exit-code == '2'
run: echo "::notice::Jalapeno updates available"
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check for Jalapeno recipe updates

on:
workflow_dispatch:
schedule:
- cron: "0 12 * * 1"

Expand All @@ -17,7 +18,9 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: futurice/jalapeno@v0.1.20
- uses: futurice/jalapeno@main
id: jalapeno
with:
cmd: check
- if: steps.jalapeno.outputs.exit-code == '2'
run: echo "::notice::Jalapeno updates available"
2 changes: 1 addition & 1 deletion examples/github-action/tests/defaults/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
values:
SCHEDULE: "0 12 * * 1"
SCHEDULE: 0 12 * * 1
ignoreExtraFiles: false

0 comments on commit a53e590

Please sign in to comment.