Skip to content

Automatically create an issue if the nightly stubtest run fails #6978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jan 20, 2022
21 changes: 21 additions & 0 deletions .github/workflows/stubtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
schedule:
- cron: "0 0 * * *"

# Please keep the permissions minimal, as stubtest runs arbitrary code from pypi.
permissions:
contents: read

Expand Down Expand Up @@ -55,3 +56,23 @@ jobs:
run: sudo apt install -y $(python tests/get_apt_packages.py)
- name: Run stubtest
run: python tests/stubtest_third_party.py --num-shards 4 --shard-index ${{ matrix.shard-index }}

# https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
create-issue-on-failure:
name: Create an issue if stubtest failed
runs-on: ubuntu-latest
needs: [stubtest-stdlib, stubtest-third-party]
if: ${{ github.repository == 'python/typeshed' && always() && (needs.stubtest-stdlib.result == 'failure' || needs.stubtest-third-party.result == 'failure') }}
permissions:
issues: write
steps:
- uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.issues.create({
owner: "python",
repo: "typeshed",
title: `Stubtest failed on ${new Date().toDateString()}`,
body: "Stubtest runs are listed here: https://github.com/python/typeshed/actions/workflows/stubtest.yml",
})