Skip to content

Commit 086124e

Browse files
committed
feat(deps): add automated failure monitoring for dependency extraction workflows
- Add GitHub issue creation on workflow failures - Nightly workflow: Create/update a single tracking issue for repeated failures - Release workflow: Create version-specific issues for each failure - Includes actionable troubleshooting steps and direct links to failed runs Benefits: - Automatic alerting when nightly extraction fails - Prevents silent failures from going unnoticed - Provides clear action items for responders - Avoids issue spam by updating existing nightly failure issues Signed-off-by: Dan Gil <[email protected]>
1 parent f3e79d1 commit 086124e

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

.github/workflows/dependency-extraction-nightly.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,65 @@ jobs:
171171
echo "All dependencies remain unchanged since the last extraction." >> $GITHUB_STEP_SUMMARY
172172
fi
173173
174+
- name: Create issue on failure
175+
if: failure()
176+
uses: actions/github-script@v7
177+
with:
178+
script: |
179+
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
180+
const timestamp = new Date().toISOString();
181+
182+
// Check if there's already an open issue for failed nightly runs
183+
const issues = await github.rest.issues.listForRepo({
184+
owner: context.repo.owner,
185+
repo: context.repo.repo,
186+
state: 'open',
187+
labels: 'automated,dependencies,nightly-failure',
188+
per_page: 1
189+
});
190+
191+
const issueBody = `## ⚠️ Nightly Dependency Extraction Failed
192+
193+
**Run:** ${runUrl}
194+
**Time:** ${timestamp}
195+
**Branch:** \`${{ github.ref_name }}\`
196+
197+
### Failure Details
198+
The automated nightly dependency extraction workflow has failed. Please investigate and resolve the issue.
199+
200+
### Possible Causes
201+
- Parsing errors in dependency files (Dockerfiles, requirements.txt, go.mod, etc.)
202+
- Network issues accessing the repository
203+
- Changes to file structure or naming conventions
204+
- Python script errors or exceptions
205+
206+
### Action Required
207+
1. Review the workflow run logs: ${runUrl}
208+
2. Fix any identified issues
209+
3. Re-run the workflow manually to verify the fix
210+
4. Close this issue once resolved
211+
212+
**Note:** This issue was automatically created by the nightly dependency extraction workflow.`;
213+
214+
if (issues.data.length > 0) {
215+
// Update existing issue with new failure
216+
const existingIssue = issues.data[0];
217+
await github.rest.issues.createComment({
218+
owner: context.repo.owner,
219+
repo: context.repo.repo,
220+
issue_number: existingIssue.number,
221+
body: `### 🔄 Another Failure Detected\n\n**Run:** ${runUrl}\n**Time:** ${timestamp}\n\nThe nightly dependency extraction is still failing. Please prioritize investigation.`
222+
});
223+
core.info(`Updated existing issue #${existingIssue.number}`);
224+
} else {
225+
// Create new issue
226+
await github.rest.issues.create({
227+
owner: context.repo.owner,
228+
repo: context.repo.repo,
229+
title: `⚠️ Nightly Dependency Extraction Failed - ${timestamp.split('T')[0]}`,
230+
body: issueBody,
231+
labels: ['automated', 'dependencies', 'nightly-failure', 'bug']
232+
});
233+
core.info('Created new failure issue');
234+
}
235+

.github/workflows/dependency-extraction-release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,47 @@ jobs:
160160
echo "📝 A pull request has been created to add this snapshot to the repository." >> $GITHUB_STEP_SUMMARY
161161
fi
162162
163+
- name: Create issue on failure
164+
if: failure()
165+
uses: actions/github-script@v7
166+
with:
167+
script: |
168+
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
169+
const timestamp = new Date().toISOString();
170+
const version = '${{ steps.version.outputs.version }}';
171+
172+
const issueBody = `## ⚠️ Release Dependency Snapshot Failed
173+
174+
**Version:** v${version}
175+
**Run:** ${runUrl}
176+
**Time:** ${timestamp}
177+
**Branch:** \`${{ github.ref_name }}\`
178+
179+
### Failure Details
180+
The automated release dependency snapshot workflow has failed for version v${version}.
181+
182+
### Possible Causes
183+
- Invalid version format in branch name or input
184+
- Parsing errors in dependency files
185+
- Permission issues writing to the repository
186+
- Python script errors or exceptions
187+
188+
### Action Required
189+
1. Review the workflow run logs: ${runUrl}
190+
2. Verify the version format (X.Y.Z)
191+
3. Fix any identified issues
192+
4. Re-run the workflow manually to create the snapshot
193+
5. Close this issue once resolved
194+
195+
**Note:** This issue was automatically created by the release dependency snapshot workflow.`;
196+
197+
// Create new issue for release failures (don't check for existing as these are version-specific)
198+
await github.rest.issues.create({
199+
owner: context.repo.owner,
200+
repo: context.repo.repo,
201+
title: `⚠️ Release Dependency Snapshot Failed - v${version}`,
202+
body: issueBody,
203+
labels: ['automated', 'dependencies', 'release-snapshot-failure', 'bug']
204+
});
205+
core.info(`Created failure issue for v${version}`);
206+

0 commit comments

Comments
 (0)