Skip to content
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

Test #1: issue is created on failure #2

Open
wants to merge 3 commits into
base: issue-on-ci-failure
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,41 @@ jobs:
run: bash ci/setup-toolchain.sh
if: github.event_name == 'schedule'
- name: Run tests
run: sh ci/run.sh ${{ matrix.os }}
run: sh -c "exit 1"

create_issue:
runs-on: ubuntu-latest
# the combination of these two lines seems to do the "if build_and_test failed, run this one"
needs: build_and_test
# TEST: remove the nightly trigger condition
if: always() && needs.build_and_test.result == 'failure'

permissions:
issues: write

steps:
- name: Create an issue
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
readarray -t exists < <(gh issue list --state open --label nightly-CI-failed --json number --jq '.[].number' --repo "$GITHUB_REPOSITORY")
if [[ -n "${exists[@]}" ]]; then
echo "Not opening another issue, already have ${#exists[@]} issue(s), latest at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/issues/${exists[0]}."
else
cat << EOF | gh issue create \
--label nightly-CI-failed \
--title "Nightly CI run failed" \
--repo "$GITHUB_REPOSITORY" \
--body-file -
The nightly CI run on $(date +%F) seems to have failed.

- Check the logs at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}
- Update to the latest 'rustc-nightly' if necessary
- Investigate test run failures if any
EOF
fi

# https://forge.rust-lang.org/infra/docs/bors.html#adding-a-new-repository-to-bors
build_result:
Expand Down
2 changes: 2 additions & 0 deletions tests/cases/addition/stdout
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ warning: path changes to `Cde`

warning: 6 warnings emitted


ERROR