Automatically close weekly ci issue if weekly ci succeeds (#18016)
# Objective It's not always obvious when the issue created by the weekly CI run is safe to close. ## Solution Automatically close it when a weekly CI run succeeds so it doesn't get forgotten. ## Testing Hope.
This commit is contained in:
parent
df5e3a7b96
commit
5961df7c89
30
.github/workflows/weekly.yml
vendored
30
.github/workflows/weekly.yml
vendored
@ -12,6 +12,7 @@ env:
|
|||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
CARGO_PROFILE_TEST_DEBUG: 0
|
CARGO_PROFILE_TEST_DEBUG: 0
|
||||||
CARGO_PROFILE_DEV_DEBUG: 0
|
CARGO_PROFILE_DEV_DEBUG: 0
|
||||||
|
ISSUE_TITLE: Main branch fails to compile on Rust beta.
|
||||||
|
|
||||||
# The jobs listed here are intentionally skipped when running on forks, for a number of reasons:
|
# The jobs listed here are intentionally skipped when running on forks, for a number of reasons:
|
||||||
#
|
#
|
||||||
@ -82,6 +83,30 @@ jobs:
|
|||||||
# See tools/ci/src/main.rs for the commands this runs
|
# See tools/ci/src/main.rs for the commands this runs
|
||||||
run: cargo run -p ci -- compile
|
run: cargo run -p ci -- compile
|
||||||
|
|
||||||
|
close-any-open-issues:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: ['test', 'lint', 'check-compiles']
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
steps:
|
||||||
|
- name: Close issues
|
||||||
|
run: |
|
||||||
|
previous_issue_number=$(gh issue list \
|
||||||
|
--search "$ISSUE_TITLE in:title" \
|
||||||
|
--json number \
|
||||||
|
--jq '.[0].number')
|
||||||
|
if [[ -n $previous_issue_number ]]; then
|
||||||
|
gh issue close $previous_issue_number \
|
||||||
|
-r completed \
|
||||||
|
-c $COMMENT
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
COMMENT: |
|
||||||
|
[Last pipeline run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) successfully completed. Closing issue.
|
||||||
|
|
||||||
|
|
||||||
open-issue:
|
open-issue:
|
||||||
name: Warn that weekly CI fails
|
name: Warn that weekly CI fails
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -95,7 +120,7 @@ jobs:
|
|||||||
- name: Create issue
|
- name: Create issue
|
||||||
run: |
|
run: |
|
||||||
previous_issue_number=$(gh issue list \
|
previous_issue_number=$(gh issue list \
|
||||||
--search "$TITLE in:title" \
|
--search "$ISSUE_TITLE in:title" \
|
||||||
--json number \
|
--json number \
|
||||||
--jq '.[0].number')
|
--jq '.[0].number')
|
||||||
if [[ -n $previous_issue_number ]]; then
|
if [[ -n $previous_issue_number ]]; then
|
||||||
@ -103,14 +128,13 @@ jobs:
|
|||||||
--body "Weekly pipeline still fails: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
--body "Weekly pipeline still fails: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
else
|
else
|
||||||
gh issue create \
|
gh issue create \
|
||||||
--title "$TITLE" \
|
--title "$ISSUE_TITLE" \
|
||||||
--label "$LABELS" \
|
--label "$LABELS" \
|
||||||
--body "$BODY"
|
--body "$BODY"
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GH_REPO: ${{ github.repository }}
|
GH_REPO: ${{ github.repository }}
|
||||||
TITLE: Main branch fails to compile on Rust beta.
|
|
||||||
LABELS: C-Bug,S-Needs-Triage
|
LABELS: C-Bug,S-Needs-Triage
|
||||||
BODY: |
|
BODY: |
|
||||||
## Weekly CI run has failed.
|
## Weekly CI run has failed.
|
||||||
|
Loading…
Reference in New Issue
Block a user