Skip to content

Commit 54870e5

Browse files
authored
Merge pull request #517 from GSA/1783-github-action-issue-creation
1783: GH Action Issue Alerts
2 parents aac7621 + 14e70f2 commit 54870e5

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/workflows/create-a11y-snapshot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,16 @@ jobs:
3030
-c "node dist/apps/cli/main.js create-a11y-snapshot"
3131
-k 4G -m 4G
3232
--name github-action-create-a11y-snapshot-${{ github.run_id }}
33+
34+
- name: Create issue on failure
35+
if: failure()
36+
uses: actions/github-script@v7
37+
with:
38+
github-token: ${{ secrets.SITE_SCANNING_ISSUE_REPO_TOKEN }}
39+
script: |
40+
await github.rest.issues.create({
41+
owner: 'gsatts-sitescan',
42+
repo: 'site-scanning',
43+
title: `Workflow failed: ${context.workflow}`,
44+
body: `Workflow **${context.workflow}** failed in [${context.repo.owner}/${context.repo.repo}](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).\n\nRef: \`${context.ref}\`\nSHA: \`${context.sha}\``
45+
});

.github/workflows/create-daily-snapshots.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,16 @@ jobs:
3030
-c "node dist/apps/cli/main.js create-daily-snapshot"
3131
-k 4G -m 4G
3232
--name github-action-create-daily-snapshots-${{ github.run_id }}
33+
34+
- name: Create issue on failure
35+
if: failure()
36+
uses: actions/github-script@v7
37+
with:
38+
github-token: ${{ secrets.SITE_SCANNING_ISSUE_REPO_TOKEN }}
39+
script: |
40+
await github.rest.issues.create({
41+
owner: 'gsatts-sitescan',
42+
repo: 'site-scanning',
43+
title: `Workflow failed: ${context.workflow}`,
44+
body: `Workflow **${context.workflow}** failed in [${context.repo.owner}/${context.repo.repo}](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).\n\nRef: \`${context.ref}\`\nSHA: \`${context.sha}\``
45+
});

0 commit comments

Comments
 (0)