-
-
Notifications
You must be signed in to change notification settings - Fork 638
Make /run-skipped-ci persistent using full-ci label #2007
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6fc849c
Make /run-skipped-ci persistent using full-ci label
justin808 400bb80
Fix YAML syntax error in stop-run-skipped-ci workflow
justin808 1015fe9
Fix critical bug: incorrect output reference in workflow files
justin808 aac7121
Improve full-ci label implementation with better output handling and UX
justin808 f9da7d3
Refactor full-ci label implementation and fix code review issues
justin808 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| name: Stop Full CI Suite | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| stop-full-ci: | ||
| # Only run on PR comments that match the command | ||
| if: | | ||
| github.event.issue.pull_request && | ||
| ( | ||
| startsWith(github.event.comment.body, '/stop-run-skipped-ci') || | ||
| contains(github.event.comment.body, '\n/stop-run-skipped-ci') | ||
| ) | ||
| runs-on: ubuntu-22.04 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| steps: | ||
| - name: Check if user has write access | ||
| id: check_access | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| try { | ||
| const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| username: context.actor | ||
| }); | ||
| const hasAccess = ['admin', 'write'].includes(permission.permission); | ||
| console.log(`User ${context.actor} has permission: ${permission.permission}`); | ||
| if (!hasAccess) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: `@${context.actor} Sorry, only repository collaborators with write access can stop full CI runs. 🔒` | ||
| }); | ||
| } | ||
| return hasAccess; | ||
| } catch (error) { | ||
| console.error('Error checking permissions:', error); | ||
| return false; | ||
| } | ||
| - name: Exit if no access | ||
| if: steps.check_access.outputs.result == 'false' | ||
| run: | | ||
| echo "User does not have permission to stop full CI" | ||
| exit 1 | ||
| - name: Add reaction to comment | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| with: | ||
| comment-id: ${{ github.event.comment.id }} | ||
| reactions: 'eyes' | ||
|
|
||
| - name: Remove full-ci label | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| try { | ||
| await github.rest.issues.removeLabel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| name: 'full-ci' | ||
| }); | ||
| console.log('✅ Removed full-ci label from PR'); | ||
| // Post success comment | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: `✅ **Full CI Mode Disabled** | ||
| The \`full-ci\` label has been removed. Future commits will use the standard CI suite (skipping tests for unchanged code). | ||
|
|
||
| To re-enable full CI mode, use the \`/run-skipped-ci\` command.` | ||
| }); | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } catch (error) { | ||
| if (error.status === 404) { | ||
| console.log('ℹ️ Label not found - already removed or never added'); | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: `ℹ️ **Full CI Mode Already Disabled** | ||
| The \`full-ci\` label is not present on this PR. CI is already running in standard mode.` | ||
| }); | ||
| } else { | ||
| console.error('❌ Failed to remove label:', error); | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: `❌ **Error Removing Label** | ||
| Failed to remove the \`full-ci\` label: ${error.message}` | ||
| }); | ||
| throw error; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.