generate #196
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: generate | |
on: | |
# Run hourly (12 minutes past the hour as recommended by GitHub) | |
schedule: | |
- cron: '12 * * * *' | |
# Allow manual triggering | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
generate: | |
name: run-generate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 | |
with: | |
go-version-file: 'go.mod' | |
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
- name: Run make generate | |
run: make generate | |
# Open/update an issue if a scheduled workflow fails | |
notify: | |
name: open issue on failed workflow | |
needs: generate | |
permissions: | |
contents: read | |
issues: write | |
if: failure() && github.event.pull_request == null | |
runs-on: ubuntu-latest | |
steps: | |
- uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b # v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
label-name: bot/generate-fail | |
# Close any open issues if a workflow succeeds | |
close: | |
name: close issues on successful workflow | |
needs: generate | |
permissions: | |
contents: read | |
issues: write | |
if: success() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Close issue | |
run: | | |
set -eou pipefail | |
# Close any existing issues with the generate-fail label | |
for num in $(gh issue list -l "bot/generate-fail" --state open --json number --jq '.[].number'); do | |
gh issue close "$num" -c "Auto-closing on subsequent successful build" -r completed | |
done | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |