Q. Github Workflowsが落ちたらIssueを作らせたい
Github Workflowsが落ちたらIssueを作らせる方法について調査した結果をまとめた。
continue-on-error
とプリインストールされているghコマンドを使えば簡単に出来る。
name: Test
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
timeout-minutes: 8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test
id: test
run: |
exit 1
continue-on-error: true
- name: Create issue
run: |
gh issue create --assignee "hrdtbs" --title "Issue report" --body "" --repo $GITHUB_REPOSITORY
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.test.outcome == 'failure'