Skip to content

Commit 3eba734

Browse files
authored
Merge branch 'leader' into migrate-gemini-3.1-flash-lite-10826941581257662795
2 parents 696c0ec + 4090c4b commit 3eba734

12 files changed

Lines changed: 157 additions & 128 deletions

.github/workflows/auto-rebase.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
fi
3333
3434
- name: Rebase PRs
35-
uses: peter-evans/rebase@v4
35+
uses: peter-evans/rebase@v5
3636
with:
3737
token: ${{ secrets.PAT_TOKEN }} # A PAT with 'repo' scope is required to allow the action to push to protected branches and trigger CI.
3838
base: leader

.github/workflows/conflict-resolver.yml

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,104 +30,120 @@ on:
3030
required: true
3131
type: string
3232

33+
env:
34+
TARGET: ${{ inputs.target_branch }}
35+
SOURCE: ${{ inputs.source_branch }}
36+
PR_NUMBER: ${{ inputs.pr_number }}
37+
3338
jobs:
3439
merge_and_resolve:
3540
runs-on: ubuntu-latest
3641
permissions:
3742
contents: write
3843
pull-requests: write
3944
steps:
40-
- name: Install jq
41-
run: |
42-
if ! command -v jq &> /dev/null; then
43-
sudo apt-get update && sudo apt-get install -y jq
44-
fi
4545
- name: Create or update comment
46-
if: inputs.pr_number && inputs.pr_number != '0'
46+
if: env.PR_NUMBER && env.PR_NUMBER != '0'
4747
uses: peter-evans/create-or-update-comment@v5
4848
with:
49-
issue-number: ${{ inputs.pr_number }}
49+
issue-number: ${{ env.PR_NUMBER }}
5050
body: |
51-
⏳ Attempting to automatically resolve conflicts for branch `${{ inputs.source_branch }}`...
51+
⏳ Attempting to automatically resolve conflicts for branch `${{ env.SOURCE }}`...
5252
<!-- id: conflict-resolver-bot -->
5353
token: ${{ secrets.GITHUB_TOKEN }}
5454

5555
- name: Checkout source branch
5656
uses: actions/checkout@v4
5757
with:
58-
ref: ${{ inputs.source_branch }}
58+
ref: ${{ env.SOURCE }}
5959
fetch-depth: 0
60-
token: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
60+
token: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
6161

6262
- name: Validate branches
6363
id: validate_branches
64+
shell: bash
6465
run: |
65-
if ! git ls-remote --exit-code --heads origin ${{ inputs.target_branch }}; then
66-
echo "::error::Target branch '${{ inputs.target_branch }}' not found."
67-
exit 1
66+
if ! git ls-remote --exit-code --heads origin "$TARGET" > /dev/null 2>&1; then
67+
echo "::warning::Target branch $TARGET missing. Skipping resolver."
68+
echo "skipped=true" >> $GITHUB_OUTPUT
69+
echo "error_msg=❌ Error: Target branch \`$TARGET\` not found. Please ensure the target branch exists and the bot has permissions to access it." >> $GITHUB_OUTPUT
70+
exit 0
6871
fi
69-
if ! git ls-remote --exit-code --heads origin ${{ inputs.source_branch }}; then
70-
echo "::error::Source branch '${{ inputs.source_branch }}' not found."
71-
exit 1
72+
73+
if ! git ls-remote --exit-code --heads origin "$SOURCE" > /dev/null 2>&1; then
74+
echo "::warning::Source branch $SOURCE missing. Skipping resolver."
75+
echo "skipped=true" >> $GITHUB_OUTPUT
76+
echo "error_msg=❌ Error: Source branch \`$SOURCE\` not found. It may have been deleted or renamed." >> $GITHUB_OUTPUT
77+
exit 0
7278
fi
73-
# Capture base SHA (target branch)
74-
git fetch origin ${{ inputs.target_branch }}
75-
echo "base_sha=$(git rev-parse origin/${{ inputs.target_branch }})" >> $GITHUB_OUTPUT
79+
80+
git fetch origin "$TARGET"
81+
echo "base_sha=$(git rev-parse origin/"$TARGET")" >> $GITHUB_OUTPUT
82+
echo "skipped=false" >> $GITHUB_OUTPUT
83+
84+
- name: Comment on validation failure
85+
if: steps.validate_branches.outputs.skipped == 'true' && env.PR_NUMBER && env.PR_NUMBER != '0'
86+
uses: peter-evans/create-or-update-comment@v5
87+
with:
88+
issue-number: ${{ env.PR_NUMBER }}
89+
body: |
90+
${{ steps.validate_branches.outputs.error_msg }}
91+
<!-- id: conflict-resolver-bot -->
92+
token: ${{ secrets.GITHUB_TOKEN }}
7693

7794
- name: Merge target branch
95+
if: steps.validate_branches.outputs.skipped != 'true'
7896
run: |
7997
git config user.name "github-actions[bot]"
8098
git config user.email "github-actions[bot]@users.noreply.github.com"
81-
git fetch origin ${{ inputs.target_branch }}
82-
git merge origin/${{ inputs.target_branch }} --no-commit --no-ff || true
99+
git fetch origin "$TARGET"
100+
git merge origin/"$TARGET" --no-commit --no-ff || true
83101
84102
- name: Resolve conflicts
103+
if: steps.validate_branches.outputs.skipped != 'true'
85104
id: resolve
86105
uses: VeyronSakai/conflict-resolver@7d650534ba240658a381241823f8b4f13861c2ad # pin to v0.5.1
87106
with:
88107
config-path: .github/conflict-resolver.yml
89108

90109
- name: Commit and push changes
91-
if: steps.resolve.outputs.unresolved-files == ''
110+
if: steps.validate_branches.outputs.skipped != 'true' && steps.resolve.outputs.unresolved-files == ''
92111
run: |
93112
git add .
94-
git commit -m "Auto-resolve merge conflicts by merging ${{ inputs.target_branch }}"
113+
git commit -m "Auto-resolve merge conflicts by merging $TARGET"
95114
git push --force
96115
echo "resolved_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
97116
id: commit_push
98117

99118
- name: Trigger Gemini Orchestrator
100-
if: steps.resolve.outputs.unresolved-files == '' && inputs.pr_number && inputs.pr_number != '0'
119+
if: steps.validate_branches.outputs.skipped != 'true' && steps.resolve.outputs.unresolved-files == '' && env.PR_NUMBER && env.PR_NUMBER != '0'
101120
env:
102-
# Use CI_BOT_PAT if available to ensure workflow is triggered (GITHUB_TOKEN prevents recursion)
103-
GH_TOKEN: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
104-
SOURCE_BRANCH: ${{ inputs.source_branch }}
121+
GH_TOKEN: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
105122
HEAD_SHA: ${{ steps.commit_push.outputs.resolved_sha }}
106123
BASE_SHA: ${{ steps.validate_branches.outputs.base_sha }}
107-
PR_NUMBER: ${{ inputs.pr_number }}
108124
run: |
109-
gh workflow run "Gemini Orchestrator" --ref "$SOURCE_BRANCH" -f pr_number="$PR_NUMBER" -f base_ref="$BASE_SHA" -f head_ref="$HEAD_SHA" -f base_branch="$TARGET_BRANCH"
125+
gh workflow run "Gemini Orchestrator" --ref "$SOURCE" -f pr_number="$PR_NUMBER" -f base_ref="$BASE_SHA" -f head_ref="$HEAD_SHA" -f base_branch="$TARGET"
110126
111127
- name: Update comment on success
112-
if: success() && steps.resolve.outputs.unresolved-files == '' && inputs.pr_number && inputs.pr_number != '0'
128+
if: steps.validate_branches.outputs.skipped != 'true' && success() && steps.resolve.outputs.unresolved-files == '' && env.PR_NUMBER && env.PR_NUMBER != '0'
113129
uses: peter-evans/create-or-update-comment@v5
114130
with:
115-
issue-number: ${{ inputs.pr_number }}
131+
issue-number: ${{ env.PR_NUMBER }}
116132
body: |
117-
✅ Successfully resolved all conflicts by merging the latest changes from `${{ inputs.target_branch }}`. The pull request has been updated.
133+
✅ Successfully resolved all conflicts by merging the latest changes from `${{ env.TARGET }}`. The pull request has been updated.
118134
119135
---
120136
#### 🤖 [Gemini Manual Trigger Guide](${{ github.server_url }}/${{ github.repository }}/blob/leader/docs/workflows/MANUAL_TRIGGERS.md)
121137
<!-- id: conflict-resolver-bot -->
122138
token: ${{ secrets.GITHUB_TOKEN }}
123139

124140
- name: Update comment on failure
125-
if: (failure() || (success() && steps.resolve.outputs.unresolved-files != '')) && inputs.pr_number && inputs.pr_number != '0'
141+
if: steps.validate_branches.outputs.skipped != 'true' && (failure() || (success() && steps.resolve.outputs.unresolved-files != '')) && env.PR_NUMBER && env.PR_NUMBER != '0'
126142
uses: peter-evans/create-or-update-comment@v5
127143
env:
128144
UNRESOLVED_FILES: ${{ steps.resolve.outputs.unresolved-files }}
129145
with:
130-
issue-number: ${{ inputs.pr_number }}
146+
issue-number: ${{ env.PR_NUMBER }}
131147
body: |
132148
❌ **Error: Unable to automatically resolve all conflicts.**
133149
The following files have unresolved conflicts:
@@ -142,7 +158,5 @@ jobs:
142158
token: ${{ secrets.GITHUB_TOKEN }}
143159

144160
- name: Fail the workflow if conflicts were not resolved
145-
if: steps.resolve.outputs.unresolved-files != ''
146-
run: |
147-
echo "Workflow failed because unresolved conflicts remain."
148-
exit 1
161+
if: steps.validate_branches.outputs.skipped != 'true' && steps.resolve.outputs.unresolved-files != ''
162+
run: exit 1

.github/workflows/deploy.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ jobs:
8989
SPOTIFY_CLIENT_ID=${{ secrets.SPOTIFY_CLIENT_ID }}
9090
SPOTIFY_CLIENT_SECRET=${{ secrets.SPOTIFY_CLIENT_SECRET }}
9191
SPOTIFY_CALLBACK_URL=${{ secrets.SPOTIFY_CALLBACK_URL }}
92-
INTERNAL_TOKEN_DELIVERY_SECRET=${{ secrets.INTERNAL_TOKEN_DELIVERY_SECRET }}
93-
ENCRYPTION_KEY=${{ secrets.ENCRYPTION_KEY }}
9492
GOOGLE_DOC_IFRAME_URL="${{ secrets.GOOGLE_DOC_IFRAME_URL }}"
9593
GOOGLE_DOC_WORKOUT_URL="${{ secrets.GOOGLE_DOC_WORKOUT_URL }}"
9694
SPOTIFY_DEBUG=false

.github/workflows/e2e-ci-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
test_pr_squash:
2020
runs-on: ubuntu-latest
2121
env:
22-
GH_TOKEN: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
22+
GH_TOKEN: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
2323
steps:
2424
- name: Install jq
2525
run: |
@@ -97,7 +97,7 @@ jobs:
9797
test_conflict_resolver:
9898
runs-on: ubuntu-latest
9999
env:
100-
GH_TOKEN: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
100+
GH_TOKEN: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
101101
steps:
102102
- name: Install jq
103103
run: |
@@ -203,7 +203,7 @@ jobs:
203203
test_pr_squash_rebase:
204204
runs-on: ubuntu-latest
205205
env:
206-
GH_TOKEN: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
206+
GH_TOKEN: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
207207
steps:
208208
- name: Install jq
209209
run: |

.github/workflows/gemini-coder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
ref: ${{ (github.event.issue.pull_request || github.event.pull_request) && format('refs/pull/{0}/head', github.event.issue.number || github.event.pull_request.number) || github.sha }}
9999

100100
- name: Setup Python
101-
uses: actions/setup-python@v4
101+
uses: actions/setup-python@v5
102102
with:
103103
python-version: '3.10'
104104

.github/workflows/pr-quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ jobs:
888888
]
889889
runs-on: ubuntu-latest
890890
env:
891-
GH_TOKEN: ${{ secrets.GH_TOKEN || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
891+
GH_TOKEN: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
892892
outputs:
893893
failure-report-json: ${{ steps.generate-failure-report.outputs.failure_report_json }}
894894
steps:

.github/workflows/pr-squash.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: Checkout PR branch
9898
uses: actions/checkout@v4
9999
with:
100-
token: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
100+
token: ${{ secrets.PAT_TOKEN || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
101101
ref: ${{ steps.pr_data.outputs.head_ref }}
102102
fetch-depth: 0
103103

@@ -212,7 +212,7 @@ jobs:
212212
- name: Checkout PR branch
213213
uses: actions/checkout@v4
214214
with:
215-
token: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
215+
token: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
216216
ref: ${{ needs.squash-and-rebase.outputs.head_ref }}
217217
fetch-depth: 0
218218
- name: Check for file changes
@@ -233,8 +233,7 @@ jobs:
233233
fi
234234
- name: Trigger Gemini Orchestrator
235235
env:
236-
# Use CI_BOT_PAT if available to ensure workflow is triggered (GITHUB_TOKEN prevents recursion)
237-
GH_TOKEN: ${{ secrets.CI_BOT_PAT || secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
236+
GH_TOKEN: ${{ secrets.ARI_PAT || secrets.GITHUB_TOKEN }}
238237
HEAD_BRANCH: ${{ needs.squash-and-rebase.outputs.head_ref }}
239238
BASE_BRANCH: ${{ needs.squash-and-rebase.outputs.base_ref }}
240239
BASE_SHA: ${{ needs.squash-and-rebase.outputs.base_sha }}

.github/workflows/reusable-create-review-issues.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
name: review-result
100100
run-id: ${{ inputs.run_id }}
101101
path: .
102-
github-token: ${{ secrets.gh_token }}
102+
github-token: ${{ secrets.GITHUB_TOKEN }}
103103

104104
- name: Verify Artifact
105105
id: verify_artifact
@@ -117,7 +117,7 @@ jobs:
117117
env:
118118
PR_NUMBER: ${{ inputs.pr_number }}
119119
BASE_SHA: ${{ inputs.base_sha }}
120-
GH_TOKEN: ${{ secrets.gh_token }}
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121121
GITHUB_REPOSITORY: ${{ github.repository }}
122122
run: |
123123
pnpm tsx scripts/ci/run-create-review-issues.ts

.github/workflows/reusable-gemini-invoke.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
- name: Run Gemini Client
2626
env:
2727
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
28-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929
COMMENT_BODY: ${{ inputs.comment_body }}
3030
run: pnpm tsx scripts/gemini-client.ts --comment-body "$COMMENT_BODY"

.github/workflows/reusable-jules-command.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
id: pr_context
5656
if: env.COMMAND == 'new'
5757
env:
58-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5959
PR_NUMBER: ${{ inputs.issue_number }}
6060
run: |
6161
# Fetch basic PR data
@@ -103,7 +103,7 @@ jobs:
103103
id: find_session_id
104104
if: env.COMMAND == 'delete'
105105
env:
106-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
106+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107107
PR_NUMBER: ${{ inputs.issue_number }}
108108
run: |
109109
SESSION_ID=$(gh pr view "$PR_NUMBER" --json comments --jq '.comments | .[] | .body' | grep -oP '(?<=<!-- JULES_SESSION_ID=)\S+(?= *-->)' | tail -n 1)
@@ -193,7 +193,7 @@ jobs:
193193
if: success() && env.COMMAND == 'new'
194194
uses: actions/github-script@v6
195195
with:
196-
github-token: ${{ secrets.GH_TOKEN }}
196+
github-token: ${{ secrets.GITHUB_TOKEN }}
197197
script: |
198198
const sessionId = "${{ steps.jules_op_new.outputs.session_id }}";
199199
if (sessionId) {
@@ -209,7 +209,7 @@ jobs:
209209
if: success()
210210
uses: actions/github-script@v7
211211
with:
212-
github-token: ${{ secrets.GH_TOKEN }}
212+
github-token: ${{ secrets.GITHUB_TOKEN }}
213213
script: |
214214
github.rest.reactions.createForIssueComment({
215215
owner: context.repo.owner,
@@ -221,7 +221,7 @@ jobs:
221221
if: failure()
222222
uses: actions/github-script@v7
223223
with:
224-
github-token: ${{ secrets.GH_TOKEN }}
224+
github-token: ${{ secrets.GITHUB_TOKEN }}
225225
script: |
226226
const errorMessageNew = `${{ steps.jules_op_new.outputs.error_message || '' }}`;
227227
const errorMessageDelete = `${{ steps.jules_op_delete.outputs.error_message || '' }}`;

0 commit comments

Comments
 (0)