-
Notifications
You must be signed in to change notification settings - Fork 8
Fix label events overwriting CI check statuses #466
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
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,47 @@ | ||||||||||||||||
| name: Retest | ||||||||||||||||
|
|
||||||||||||||||
| on: | ||||||||||||||||
| issue_comment: | ||||||||||||||||
| types: [created] | ||||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| retest: | ||||||||||||||||
| if: >- | ||||||||||||||||
| github.event.issue.pull_request && contains(github.event.comment.body, '/retest') | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
| permissions: | ||||||||||||||||
| actions: write | ||||||||||||||||
| pull-requests: read | ||||||||||||||||
| steps: | ||||||||||||||||
| - name: Check permission | ||||||||||||||||
| env: | ||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||
| run: | | ||||||||||||||||
| PERMISSION=$(gh api "repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission" -q .permission) | ||||||||||||||||
| if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "write" ]]; then | ||||||||||||||||
| echo "User ${{ github.event.comment.user.login }} does not have write permission (permission=$PERMISSION)" | ||||||||||||||||
| exit 1 | ||||||||||||||||
| fi | ||||||||||||||||
|
|
||||||||||||||||
| - name: Trigger CI | ||||||||||||||||
| env: | ||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||
| run: | | ||||||||||||||||
| PR_NUMBER=${{ github.event.issue.number }} | ||||||||||||||||
| HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid -q .headRefOid) | ||||||||||||||||
| RUN_ID=$(gh run list --workflow=ci.yaml --commit="$HEAD_SHA" --limit=1 --json databaseId -q '.[0].databaseId') | ||||||||||||||||
|
|
||||||||||||||||
| if [ -n "$RUN_ID" ]; then | ||||||||||||||||
| CONCLUSION=$(gh run view "$RUN_ID" --json conclusion -q .conclusion) | ||||||||||||||||
|
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. P2: When CI is still in-progress, Prompt for AI agents
Suggested change
|
||||||||||||||||
| if [ "$CONCLUSION" = "failure" ]; then | ||||||||||||||||
| gh run rerun "$RUN_ID" --failed | ||||||||||||||||
| exit 0 | ||||||||||||||||
| elif [ -z "$CONCLUSION" ]; then | ||||||||||||||||
| echo "CI is already in progress (run $RUN_ID)" | ||||||||||||||||
| exit 0 | ||||||||||||||||
| fi | ||||||||||||||||
| fi | ||||||||||||||||
|
|
||||||||||||||||
| HEAD_REF=$(gh pr view "$PR_NUMBER" --json headRefName -q .headRefName) | ||||||||||||||||
| OK_TO_TEST=$(gh pr view "$PR_NUMBER" --json labels -q '[.labels[].name] | any(. == "ok-to-test")') | ||||||||||||||||
| gh workflow run ci.yaml --ref "$HEAD_REF" -f "ok-to-test=$OK_TO_TEST" | ||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.