Skip to content

Commit 61495d8

Browse files
Akulisobolevn
andauthored
Automatically create an issue if the nightly stubtest run fails (#6978)
Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 556e623 commit 61495d8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/stubtest.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
schedule:
66
- cron: "0 0 * * *"
77

8+
# Please keep the permissions minimal, as stubtest runs arbitrary code from pypi.
89
permissions:
910
contents: read
1011

@@ -57,3 +58,23 @@ jobs:
5758
run: sudo apt install -y $(python tests/get_apt_packages.py)
5859
- name: Run stubtest
5960
run: python tests/stubtest_third_party.py --num-shards 4 --shard-index ${{ matrix.shard-index }}
61+
62+
# https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
63+
create-issue-on-failure:
64+
name: Create an issue if stubtest failed
65+
runs-on: ubuntu-latest
66+
needs: [stubtest-stdlib, stubtest-third-party]
67+
if: ${{ github.repository == 'python/typeshed' && always() && (needs.stubtest-stdlib.result == 'failure' || needs.stubtest-third-party.result == 'failure') }}
68+
permissions:
69+
issues: write
70+
steps:
71+
- uses: actions/github-script@v3
72+
with:
73+
github-token: ${{secrets.GITHUB_TOKEN}}
74+
script: |
75+
await github.issues.create({
76+
owner: "python",
77+
repo: "typeshed",
78+
title: `Stubtest failed on ${new Date().toDateString()}`,
79+
body: "Stubtest runs are listed here: https://github.com/python/typeshed/actions/workflows/stubtest.yml",
80+
})

0 commit comments

Comments
 (0)