Skip to content

Commit ffb7225

Browse files
authored
Merge pull request #512 from GSA/1738-action-failure-issue-creation
1738 Action Failure Issue Correction
2 parents e31f5b3 + a84e81c commit ffb7225

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/workflows/enqueue-scans.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 enqueue-scans"
3131
-k 2G -m 2G
3232
--name github-action-enqueue-scans-${{ 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/ingest.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,16 @@ jobs:
2626
--command "node dist/apps/cli/main.js ingest"
2727
-k 2G -m 2G
2828
--name github-action-ingest-${{ github.run_id }}
29+
30+
- name: Create issue on failure
31+
if: failure()
32+
uses: actions/github-script@v7
33+
with:
34+
github-token: ${{ secrets.SITE_SCANNING_ISSUE_REPO_TOKEN }}
35+
script: |
36+
await github.rest.issues.create({
37+
owner: 'gsatts-sitescan',
38+
repo: 'site-scanning',
39+
title: `Workflow failed: ${context.workflow}`,
40+
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}\``
41+
});

0 commit comments

Comments
 (0)