Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 7628280

Browse files
committed
Create an issue on nightly CI run failure
1 parent 71d2bb1 commit 7628280

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,39 @@ jobs:
4141
run: bash ci/setup-toolchain.sh
4242
if: github.event_name == 'schedule'
4343
- name: Run tests
44-
run: sh ci/run.sh ${{ matrix.os }}
44+
run: sh -c "exit 1"
45+
46+
create_issue:
47+
runs-on: ubuntu-latest
48+
# the combination of these two lines seems to do the "if build_and_test failed, run this one"
49+
needs: build_and_test
50+
if: always() && needs.build_and_test.result == 'failure'
51+
52+
permissions:
53+
issues: write
54+
55+
steps:
56+
- name: Create an issue
57+
shell: bash
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
run: |
61+
readarray -t exists < <(gh issue list --state open --label nightly-CI-failed --json number --jq '.[].number' --repo "$GITHUB_REPOSITORY")
62+
if [[ -n "${exists[@]}" ]]; then
63+
echo "Not opening another issue, already have ${#exists[@]} issue(s), latest at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/issues/${exists[0]}."
64+
else
65+
cat << EOF | gh issue create \
66+
--label nightly-CI-failed \
67+
--title "Nightly CI run failed" \
68+
--repo "$GITHUB_REPOSITORY" \
69+
--body-file -
70+
The nightly CI run on $(date +%F) seems to have failed.
71+
72+
- Check the logs at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}
73+
- Update to the latest 'rustc-nightly' if necessary
74+
- Investigate test run failures if any
75+
EOF
76+
fi
4577
4678
# https://forge.rust-lang.org/infra/docs/bors.html#adding-a-new-repository-to-bors
4779
build_result:

0 commit comments

Comments
 (0)