-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
rerun: rebuild workflow #180277
rerun: rebuild workflow #180277
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,105 @@ | ||||||||||||||||||||||||||||||||||||||||||||
name: Re-run Workflow | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
on: | ||||||||||||||||||||||||||||||||||||||||||||
workflow_run: | ||||||||||||||||||||||||||||||||||||||||||||
workflows: | ||||||||||||||||||||||||||||||||||||||||||||
- CI | ||||||||||||||||||||||||||||||||||||||||||||
types: | ||||||||||||||||||||||||||||||||||||||||||||
- completed | ||||||||||||||||||||||||||||||||||||||||||||
pull_request_target: | ||||||||||||||||||||||||||||||||||||||||||||
types: | ||||||||||||||||||||||||||||||||||||||||||||
- closed | ||||||||||||||||||||||||||||||||||||||||||||
- labeled | ||||||||||||||||||||||||||||||||||||||||||||
- unlabeled | ||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems weird to run this also on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another carryover from the previous action. If you removed a label such as |
||||||||||||||||||||||||||||||||||||||||||||
schedule: | ||||||||||||||||||||||||||||||||||||||||||||
- cron: '30 */3 * * *' # every 3 hours (30 minutes past the hour) | ||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this is run on a schedule, should we also automatically remove some of these labels at some point? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Historically, |
||||||||||||||||||||||||||||||||||||||||||||
workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||
GH_REPO: ${{ github.repository }} | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
permissions: | ||||||||||||||||||||||||||||||||||||||||||||
contents: read | ||||||||||||||||||||||||||||||||||||||||||||
actions: write | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
jobs: | ||||||||||||||||||||||||||||||||||||||||||||
scheduled-retry: | ||||||||||||||||||||||||||||||||||||||||||||
if: > | ||||||||||||||||||||||||||||||||||||||||||||
github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+27
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be cleaner to do something like this:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||||||||||||||||||||
- name: Re-run CI workflow | ||||||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||||||
PR_NUMBERS=$(gh pr list -l 'ci-retry' --json number --jq '.[].number') | ||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to use long flags where they're available for readability.
Suggested change
This may need to be done elsewhere too. |
||||||||||||||||||||||||||||||||||||||||||||
for PR_NUMBER in $PR_NUMBERS; do | ||||||||||||||||||||||||||||||||||||||||||||
echo "Processing PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
WORKFLOW_RUN_ID=$(gh pr view "$PR_NUMBER" --json headRefName --jq '.headRefName' | xargs -I {} gh run list --workflow=ci.yml --branch={} --json databaseId --jq '.[].databaseId') | ||||||||||||||||||||||||||||||||||||||||||||
if [ -n "$WORKFLOW_RUN_ID" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
echo "Rerunning workflow run #$WORKFLOW_RUN_ID for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
gh run rerun "$WORKFLOW_RUN_ID" | ||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||
echo "No runs found for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
scheduled-retry-failed-jobs: | ||||||||||||||||||||||||||||||||||||||||||||
if: > | ||||||||||||||||||||||||||||||||||||||||||||
github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||||||||||||||||||||
- name: Re-run CI workflow | ||||||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||||||
PR_NUMBERS=$(gh pr list -l 'ci-retry-failed-jobs' --json number --jq '.[].number') | ||||||||||||||||||||||||||||||||||||||||||||
for PR_NUMBER in $PR_NUMBERS; do | ||||||||||||||||||||||||||||||||||||||||||||
echo "Processing PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
WORKFLOW_RUN_ID=$(gh pr view "$PR_NUMBER" --json headRefName --jq '.headRefName' | xargs -I {} gh run list --workflow=ci.yml --branch={} --json databaseId --jq '.[].databaseId') | ||||||||||||||||||||||||||||||||||||||||||||
if [ -n "$WORKFLOW_RUN_ID" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
echo "Rerunning workflow run #$WORKFLOW_RUN_ID for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
gh run rerun "$WORKFLOW_RUN_ID" --failed | ||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||
echo "No runs found for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
trigger-rerun: | ||||||||||||||||||||||||||||||||||||||||||||
if: > | ||||||||||||||||||||||||||||||||||||||||||||
( | ||||||||||||||||||||||||||||||||||||||||||||
github.event.label.name == 'ci-syntax-only' || | ||||||||||||||||||||||||||||||||||||||||||||
github.event.label.name == 'ci-requeue' || | ||||||||||||||||||||||||||||||||||||||||||||
github.event.label.name == 'ci-skip-install' | ||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+69
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||||||||||||||||||||
- name: Re-run CI workflow | ||||||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||||||
PR_NUMBER=$(gh pr view "${{ github.event.pull_request.number }}" --json headRefName --jq '.headRefName') | ||||||||||||||||||||||||||||||||||||||||||||
WORKFLOW_RUN_ID=$(gh pr view "${{ github.event.pull_request.number }}" --json headRefName --jq '.headRefName' | xargs -I {} gh run list --workflow=ci.yml --branch={} --json databaseId,status --jq '.[].databaseId') | ||||||||||||||||||||||||||||||||||||||||||||
if [ -n "$WORKFLOW_RUN_ID" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
echo "Rerunning workflow run #$WORKFLOW_RUN_ID for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
gh run rerun "$WORKFLOW_RUN_ID" | ||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||
echo "No runs found for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+79
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's avoid interpolating right into a shell script, see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable.
Suggested change
I also don't really follow what's going on with |
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
trigger-retry-failed-jobs: | ||||||||||||||||||||||||||||||||||||||||||||
if: github.event.label.name == 'ci-requeue-failed-jobs' | ||||||||||||||||||||||||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||||||||||||||||||||
- name: Re-run CI workflow | ||||||||||||||||||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||||||||||||||||||
PR_NUMBER=$(gh pr view "${{ github.event.pull_request.number }}" --json headRefName --jq '.headRefName') | ||||||||||||||||||||||||||||||||||||||||||||
WORKFLOW_RUN_ID=$(gh pr view "${{ github.event.pull_request.number }}" --json headRefName --jq '.headRefName' | xargs -I {} gh run list --workflow=ci.yml --branch={} --json databaseId --jq '.[].databaseId') | ||||||||||||||||||||||||||||||||||||||||||||
if [ -n "$WORKFLOW_RUN_ID" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
echo "Rerunning workflow run #$WORKFLOW_RUN_ID for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
gh run rerun "$WORKFLOW_RUN_ID" --failed | ||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||
echo "No runs found for PR #$PR_NUMBER" | ||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||||||||||||||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this? I don't think you do anything about closed PRs below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a leftover from the previous workflow that I started with. I will remove it.