Skip to content

Commit ba2ab78

Browse files
committed
Create an issue on nightly CI run failure
1 parent 0431504 commit ba2ab78

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,41 @@ 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+
# TEST: remove the nightly trigger condition
51+
if: always() && needs.build_and_test.result == 'failure'
52+
53+
permissions:
54+
issues: write
55+
56+
steps:
57+
- name: Create an issue
58+
shell: bash
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
run: |
62+
set -x
63+
readarray -t exists < <(gh issue list --state open --label nightly-CI-failed --json number --jq '.[].number' --repo "$GITHUB_REPOSITORY")
64+
if [[ -n "${exists[@]}" ]]; then
65+
echo "Not opening another issue, already have ${#exists[@]} issue(s), latest at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/issues/${exists[0]}."
66+
else
67+
cat << EOF | gh issue create \
68+
--label nightly-CI-failed \
69+
--title "Nightly CI run failed" \
70+
--repo "$GITHUB_REPOSITORY" \
71+
--body-file -
72+
The nightly CI run on $(date +%F) seems to have failed.
73+
74+
- Check the logs at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}
75+
- Update to the latest 'rustc-nightly' if necessary
76+
- Investigate test run failures if any
77+
EOF
78+
fi
4579
4680
# https://forge.rust-lang.org/infra/docs/bors.html#adding-a-new-repository-to-bors
4781
build_result:

tests/cases/addition/stdout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ warning: path changes to `Cde`
5656

5757
warning: 6 warnings emitted
5858

59+
60+
ERROR

0 commit comments

Comments
 (0)