Add several improvements to GHA example

- "workflow_dispatch" so we can trigger manually
- "concurrency" so we avoid over-triggering when updating PRs/branches
- multi-line string in GITHUB_OUTPUT for better output and less flakiness
This commit is contained in:
Tianon Gravi 2023-07-18 09:00:08 -07:00
parent a67d6088ac
commit a0ec8ceff9
1 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,7 @@ name: GitHub CI
on: on:
pull_request: pull_request:
push: push:
workflow_dispatch:
schedule: schedule:
- cron: 0 0 * * 0 - cron: 0 0 * * 0
@ -10,6 +11,10 @@ defaults:
run: run:
shell: 'bash -Eeuo pipefail -x {0}' shell: 'bash -Eeuo pipefail -x {0}'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
generate-jobs: generate-jobs:
@ -24,8 +29,11 @@ jobs:
name: Generate Jobs name: Generate Jobs
run: | run: |
strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")"
echo "strategy=$strategy" >> "$GITHUB_OUTPUT"
jq . <<<"$strategy" # sanity check / debugging aid EOF="EOF-$RANDOM-$RANDOM-$RANDOM"
echo "strategy<<$EOF" >> "$GITHUB_OUTPUT"
jq <<<"$strategy" . | tee -a "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
test: test:
needs: generate-jobs needs: generate-jobs