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

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Akuli
2022-01-20 18:24:14 +02:00
committed by GitHub
parent 556e623a81
commit 61495d80aa

View File

@@ -5,6 +5,7 @@ on:
schedule:
- cron: "0 0 * * *"
# Please keep the permissions minimal, as stubtest runs arbitrary code from pypi.
permissions:
contents: read
@@ -57,3 +58,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",
})