Skip to content

Commit 7e9b7da

Browse files
authored
Update additional.yaml workflow to post issue on error (#2498)
* Update additional.yaml workflow to post issue on error * Prevent skip on failure
1 parent baa20f2 commit 7e9b7da

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/additional.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,38 @@ jobs:
3030
- uses: actions/checkout@v5
3131
- uses: prefix-dev/setup-pixi@v0.9.0
3232
- run: pixi run docs-linkcheck
33+
34+
create-issue-on-failure:
35+
name: Create issue on failure
36+
runs-on: ubuntu-latest
37+
needs: [min-version-policy, linkcheck]
38+
if: |
39+
always() &&
40+
(needs.min-version-policy.result == 'failure' || needs.linkcheck.result == 'failure') &&
41+
github.event_name == 'schedule'
42+
permissions:
43+
issues: write
44+
steps:
45+
- name: Create issue
46+
uses: actions/github-script@v7
47+
with:
48+
script: |
49+
const workflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
50+
const title = `CI Additional workflow failed - ${new Date().toISOString().split('T')[0]}`;
51+
const body = `The [CI Additional workflow](${workflowUrl}) failed on its scheduled run.
52+
53+
**Workflow Run:** ${context.runId}
54+
**Trigger:** ${context.eventName}
55+
**Branch:** ${context.ref}
56+
57+
Please investigate the failure and fix the issues.
58+
59+
_This issue was automatically created by the workflow._`;
60+
61+
await github.rest.issues.create({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
title: title,
65+
body: body,
66+
labels: ['bug', 'automated']
67+
});

0 commit comments

Comments
 (0)