Skip to content

Commit c9b24bc

Browse files
authored
Open issue when release failed (#715)
When release job fails, we may not realize the issue. Let's open issue to notify us the release job failed. I've tested this change and it opened an issue like this. - title contains the release(d) version - actor is assigned - description contains failed job url ![image](https://github.com/user-attachments/assets/d2f0464d-2d0f-413a-b0df-da7966289e7e)
1 parent 42835f1 commit c9b24bc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
fi
3939
4040
VERSION=${VERSION#v}
41+
echo "VERSION=$VERSION" >> $GITHUB_ENV
4142
python tools/update_version.py $VERSION
4243
- name: Build and publish
4344
env:
@@ -46,3 +47,22 @@ jobs:
4647
run: |
4748
python setup.py sdist bdist_wheel
4849
twine upload dist/*
50+
51+
- name: Create GitHub Issue on Failure
52+
if: failure()
53+
uses: actions/github-script@v7
54+
with:
55+
script: |
56+
const { owner, repo } = context.repo;
57+
const version = process.env.VERSION;
58+
const issueTitle = `Release job for ${version} failed`;
59+
const issueBody = `The release job failed. Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`;
60+
const assignees = [context.actor];
61+
62+
await github.rest.issues.create({
63+
owner,
64+
repo,
65+
title: issueTitle,
66+
body: issueBody,
67+
assignees
68+
});

0 commit comments

Comments
 (0)