-
Notifications
You must be signed in to change notification settings - Fork 7
New labeled workflow to trigger Claude Code Review #121
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
77092f0
Craft workflow to workaround Claude Code limitations on PR triggeringβ¦
theMickster 0d8178e
Claude Code review requested
bitwarden-devops-bot 95db03d
Lint enhancements
theMickster dedecba
Work with Claude to implement suggestions. No positive about the git β¦
theMickster 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| name: Trigger AI Review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled] | ||
|
|
||
| permissions: | ||
| actions: read | ||
| contents: write | ||
| id-token: write | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| trigger-review: | ||
| name: Trigger Claude Code Review | ||
| if: | | ||
| github.event.label.name == 'ai-review' && | ||
| github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com | ||
| _BOT_NAME: bitwarden-devops-bot | ||
| steps: | ||
| - name: Log in to Azure | ||
| uses: bitwarden/gh-actions/azure-login@main | ||
| with: | ||
| subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| tenant_id: ${{ secrets.AZURE_TENANT_ID }} | ||
| client_id: ${{ secrets.AZURE_CLIENT_ID }} | ||
|
|
||
| - name: Get Azure Key Vault secrets | ||
| id: get-kv-secrets | ||
| uses: bitwarden/gh-actions/get-keyvault-secrets@main | ||
| with: | ||
| keyvault: gh-org-bitwarden | ||
| secrets: "BW-GHAPP-ID,BW-GHAPP-KEY" | ||
|
|
||
| - name: Log out from Azure | ||
| uses: bitwarden/gh-actions/azure-logout@main | ||
|
|
||
| - name: Generate GH App token | ||
| uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }} | ||
| private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }} | ||
| owner: ${{ github.repository_owner }} | ||
| repositories: ${{ github.event.repository.name }} | ||
|
|
||
| - name: Checkout PR branch | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Configure Git & push empty commit to trigger Claude Code review | ||
| env: | ||
| _PR_BRANCH: ${{ github.event.pull_request.head.ref }} | ||
| _GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| set -e | ||
|
|
||
| # Setup trap to ensure credentials are always cleaned up | ||
| cleanup() { | ||
| git config --local --unset-all http.https://github.com/.extraheader || true | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| # Configure git user | ||
| git config --local user.email "${_BOT_EMAIL}" | ||
| git config --local user.name "${_BOT_NAME}" | ||
|
|
||
| # Configure git credentials for push (needed because persist-credentials: false) | ||
| # Use the same format as actions/checkout: Basic auth with base64-encoded x-access-token | ||
| BASIC_CREDENTIAL=$(echo -n "x-access-token:${_GH_TOKEN}" | base64) | ||
| git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${BASIC_CREDENTIAL}" | ||
|
|
||
| # Create and push empty commit | ||
| git commit --allow-empty -m "Claude Code review requested" || { | ||
| echo "::error::Failed to create empty commit" | ||
| exit 1 | ||
| } | ||
| git push origin "${_PR_BRANCH}" || { | ||
| echo "::error::Failed to push commit to ${_PR_BRANCH}" | ||
| exit 1 | ||
| } | ||
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.
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.
β QUESTION: How does
git pushsucceed withpersist-credentials: false?Clarification needed
The workflow uses
persist-credentials: falsewhich according to theactions/checkoutdocumentation should prevent credentials from being configured in git config. However, the subsequentgit push origincommand at line 64 requires authentication.Looking at commit
0d8178e, the push clearly succeeded. How are credentials being provided to git?Possible explanations:
tokenparameter at line 53 is being persisted despitepersist-credentials: falsepersist-credentialschanged in checkout v6Could you clarify the intended behavior? This affects the security model of the workflow.