Skip to content

Commit 7551586

Browse files
committed
agent :: gemini gitaction 에러 수정
1 parent 0e4bc73 commit 7551586

7 files changed

Lines changed: 45 additions & 106 deletions

.github/workflows/gemini-bug-guide.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
id: 'mint_identity_token'
3131
if: |-
3232
${{ vars.APP_ID }}
33-
uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2
33+
uses: 'actions/create-github-app-token@v2'
3434
with:
3535
app-id: '${{ vars.APP_ID }}'
3636
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
@@ -40,13 +40,13 @@ jobs:
4040

4141
- name: 'Run Gemini Bug Analysis'
4242
id: 'gemini_analysis'
43-
uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude
43+
uses: 'google-github-actions/run-gemini-cli@v0'
4444
env:
4545
GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN || github.token }}'
4646
ISSUE_TITLE: '${{ github.event.issue.title }}'
4747
ISSUE_BODY: '${{ github.event.issue.body }}'
4848
ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}'
49-
GEMINI_CLI_TRUST_WORKSPACE: true
49+
GEMINI_CLI_TRUST_WORKSPACE: 'true'
5050
with:
5151
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
5252
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'

.github/workflows/gemini-invoke.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
id: 'mint_identity_token'
3030
if: |-
3131
${{ vars.APP_ID }}
32-
uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2
32+
uses: 'actions/create-github-app-token@v2'
3333
with:
3434
app-id: '${{ vars.APP_ID }}'
3535
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
@@ -38,11 +38,11 @@ jobs:
3838
permission-pull-requests: 'write'
3939

4040
- name: 'Checkout Code'
41-
uses: 'actions/checkout@v4' # ratchet:exclude
41+
uses: 'actions/checkout@v4'
4242

4343
- name: 'Run Gemini CLI'
4444
id: 'run_gemini'
45-
uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude
45+
uses: 'google-github-actions/run-gemini-cli@v0'
4646
env:
4747
TITLE: '${{ github.event.pull_request.title || github.event.issue.title }}'
4848
DESCRIPTION: '${{ github.event.pull_request.body || github.event.issue.body }}'
@@ -52,7 +52,7 @@ jobs:
5252
ISSUE_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}'
5353
REPOSITORY: '${{ github.repository }}'
5454
ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}'
55-
GEMINI_CLI_TRUST_WORKSPACE: true
55+
GEMINI_CLI_TRUST_WORKSPACE: 'true'
5656
with:
5757
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
5858
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'

.github/workflows/gemini-plan-execute.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
id: 'mint_identity_token'
3232
if: |-
3333
${{ vars.APP_ID }}
34-
uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2
34+
uses: 'actions/create-github-app-token@v2'
3535
with:
3636
app-id: '${{ vars.APP_ID }}'
3737
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
@@ -40,11 +40,11 @@ jobs:
4040
permission-pull-requests: 'write'
4141

4242
- name: 'Checkout Code'
43-
uses: 'actions/checkout@v4' # ratchet:exclude
43+
uses: 'actions/checkout@v4'
4444

4545
- name: 'Run Gemini CLI'
4646
id: 'run_gemini'
47-
uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude
47+
uses: 'google-github-actions/run-gemini-cli@v0'
4848
env:
4949
TITLE: '${{ github.event.pull_request.title || github.event.issue.title }}'
5050
DESCRIPTION: '${{ github.event.pull_request.body || github.event.issue.body }}'
@@ -54,7 +54,7 @@ jobs:
5454
ISSUE_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}'
5555
REPOSITORY: '${{ github.repository }}'
5656
ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}'
57-
GEMINI_CLI_TRUST_WORKSPACE: true
57+
GEMINI_CLI_TRUST_WORKSPACE: 'true'
5858
with:
5959
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
6060
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'

.github/workflows/gemini-review.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
id: 'mint_identity_token'
3131
if: |-
3232
${{ vars.APP_ID }}
33-
uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2
33+
uses: 'actions/create-github-app-token@v2'
3434
with:
3535
app-id: '${{ vars.APP_ID }}'
3636
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
@@ -39,10 +39,10 @@ jobs:
3939
permission-pull-requests: 'write'
4040

4141
- name: 'Checkout repository'
42-
uses: 'actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8' # ratchet:actions/checkout@v6
42+
uses: 'actions/checkout@v4'
4343

4444
- name: 'Run Gemini pull request review'
45-
uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude
45+
uses: 'google-github-actions/run-gemini-cli@v0'
4646
id: 'gemini_pr_review'
4747
env:
4848
GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN || github.token }}'
@@ -51,7 +51,7 @@ jobs:
5151
PULL_REQUEST_NUMBER: '${{ github.event.pull_request.number || github.event.issue.number }}'
5252
REPOSITORY: '${{ github.repository }}'
5353
ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}'
54-
GEMINI_CLI_TRUST_WORKSPACE: true
54+
GEMINI_CLI_TRUST_WORKSPACE: 'true'
5555
with:
5656
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
5757
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'

.github/workflows/gemini-scheduled-bug-verify.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: '📅 Gemini Scheduled Bug Verify'
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # Every day at 00:00 UTC (9 AM KST)
6-
workflow_dispatch: # Allow manual trigger
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
77

88
jobs:
99
get-issues:
@@ -16,9 +16,7 @@ jobs:
1616
env:
1717
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
run: |
19-
# Get open bug issues
2019
OPEN_ISSUES=$(gh issue list --label "bug" --state open --json number --jq '.[].number' | tr '\n' ',' | sed 's/,$//')
21-
# Get closed bug issues (recent 10)
2220
CLOSED_ISSUES=$(gh issue list --label "bug" --state closed --limit 10 --json number --jq '.[].number' | tr '\n' ',' | sed 's/,$//')
2321
2422
COMBINED_ISSUES=""
@@ -34,7 +32,6 @@ jobs:
3432
echo "No bug issues found."
3533
echo "issue_numbers=[]" >> $GITHUB_OUTPUT
3634
else
37-
# Format as JSON array for matrix
3835
JSON_ARRAY=$(echo "[$COMBINED_ISSUES]" | sed 's/,/","/g' | sed 's/\[/["/' | sed 's/\]/"]/')
3936
echo "issue_numbers=$JSON_ARRAY" >> $GITHUB_OUTPUT
4037
fi
@@ -46,7 +43,7 @@ jobs:
4643
matrix:
4744
issue_number: ${{ fromJson(needs.get-issues.outputs.issue_numbers) }}
4845
fail-fast: false
49-
max-parallel: 1 # Run sequentially to avoid rate limits
46+
max-parallel: 1
5047
runs-on: ubuntu-latest
5148
permissions:
5249
contents: read
@@ -66,13 +63,13 @@ jobs:
6663
6764
- name: 'Run Gemini Bug Verification'
6865
id: 'gemini_verify'
69-
uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude
66+
uses: 'google-github-actions/run-gemini-cli@v0'
7067
env:
7168
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7269
ISSUE_TITLE: ${{ env.title }}
7370
ISSUE_BODY: ${{ env.body }}
7471
ISSUE_STATE: ${{ env.state }}
75-
GEMINI_CLI_TRUST_WORKSPACE: true
72+
GEMINI_CLI_TRUST_WORKSPACE: 'true'
7673
with:
7774
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
7875
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
@@ -93,14 +90,10 @@ jobs:
9390
ISSUE_NUMBER: ${{ matrix.issue_number }}
9491
AI_OUTPUT: ${{ steps.gemini_verify.outputs.output }}
9592
run: |
96-
# Extract components using basic parsing (assuming structured format in prompt)
9793
ACTION=$(echo "$AI_OUTPUT" | grep "^action:" | cut -d' ' -f2 | tr -d '\r')
9894
LABELS=$(echo "$AI_OUTPUT" | grep "^labels_to_add:" | cut -d' ' -f2 | tr -d '\r')
9995
COMMENT=$(echo "$AI_OUTPUT" | sed -n '/comment:/,$p' | sed '1d')
10096
101-
echo "Action: $ACTION"
102-
echo "Labels: $LABELS"
103-
10497
if [ "$ACTION" == "close_and_comment" ]; then
10598
gh issue comment $ISSUE_NUMBER --body "$COMMENT"
10699
gh issue close $ISSUE_NUMBER
@@ -109,7 +102,6 @@ jobs:
109102
gh issue reopen $ISSUE_NUMBER
110103
gh issue comment $ISSUE_NUMBER --body "$COMMENT"
111104
if [ ! -z "$LABELS" ]; then gh issue edit $ISSUE_NUMBER --add-label "$LABELS"; fi
112-
# Remove verified label if exists
113105
gh issue edit $ISSUE_NUMBER --remove-label "verified" || true
114106
elif [ "$ACTION" == "comment" ]; then
115107
gh issue comment $ISSUE_NUMBER --body "$COMMENT"

.github/workflows/gemini-scheduled-triage.yml

Lines changed: 17 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@ name: '📋 Gemini Scheduled Issue Triage'
22

33
on:
44
schedule:
5-
- cron: '0 * * * *' # Runs every hour
5+
- cron: '0 * * * *'
66
pull_request:
7-
branches:
8-
- 'main'
9-
- 'release/**/*'
10-
paths:
11-
- '.github/workflows/gemini-scheduled-triage.yml'
7+
branches: [main]
8+
paths: ['.github/workflows/gemini-scheduled-triage.yml']
129
push:
13-
branches:
14-
- 'main'
15-
- 'release/**/*'
16-
paths:
17-
- '.github/workflows/gemini-scheduled-triage.yml'
10+
branches: [main]
11+
paths: ['.github/workflows/gemini-scheduled-triage.yml']
1812
workflow_dispatch:
1913

2014
concurrency:
@@ -40,17 +34,14 @@ jobs:
4034
steps:
4135
- name: 'Get repository labels'
4236
id: 'get_labels'
43-
uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8.0.0
37+
uses: 'actions/github-script@v7'
4438
with:
45-
# NOTE: we intentionally do not use the minted token. The default
46-
# GITHUB_TOKEN provided by the action has enough permissions to read
47-
# the labels.
4839
script: |-
4940
const labels = [];
5041
for await (const response of github.paginate.iterator(github.rest.issues.listLabelsForRepo, {
5142
owner: context.repo.owner,
5243
repo: context.repo.repo,
53-
per_page: 100, // Maximum per page to reduce API calls
44+
per_page: 100,
5445
})) {
5546
labels.push(...response.data);
5647
}
@@ -70,32 +61,26 @@ jobs:
7061
GITHUB_REPOSITORY: '${{ github.repository }}'
7162
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN || github.token }}'
7263
run: |-
73-
echo '🔍 Finding unlabeled issues and issues marked for triage...'
7464
ISSUES="$(gh issue list \
7565
--state 'open' \
7666
--search 'no:label label:"status/needs-triage"' \
7767
--json number,title,body \
7868
--limit '100' \
7969
--repo "${GITHUB_REPOSITORY}"
8070
)"
81-
82-
echo '📝 Setting output for GitHub Actions...'
8371
echo "issues_to_triage=${ISSUES}" >> "${GITHUB_OUTPUT}"
8472
85-
ISSUE_COUNT="$(echo "${ISSUES}" | jq 'length')"
86-
echo "✅ Found ${ISSUE_COUNT} issue(s) to triage! 🎯"
87-
8873
- name: 'Run Gemini Issue Analysis'
8974
id: 'gemini_issue_analysis'
9075
if: |-
9176
${{ steps.find_issues.outputs.issues_to_triage != '[]' }}
92-
uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude
77+
uses: 'google-github-actions/run-gemini-cli@v0'
9378
env:
94-
GITHUB_TOKEN: '' # Do not pass any auth token here since this runs on untrusted inputs
79+
GITHUB_TOKEN: ''
9580
ISSUES_TO_TRIAGE: '${{ steps.find_issues.outputs.issues_to_triage }}'
9681
REPOSITORY: '${{ github.repository }}'
9782
AVAILABLE_LABELS: '${{ steps.get_labels.outputs.available_labels }}'
98-
GEMINI_CLI_TRUST_WORKSPACE: true
83+
GEMINI_CLI_TRUST_WORKSPACE: 'true'
9984
with:
10085
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
10186
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
@@ -125,13 +110,10 @@ jobs:
125110

126111
label:
127112
runs-on: 'ubuntu-latest'
128-
needs:
129-
- 'triage'
113+
needs: [triage]
130114
if: |-
131115
needs.triage.outputs.available_labels != '' &&
132-
needs.triage.outputs.available_labels != '[]' &&
133-
needs.triage.outputs.triaged_issues != '' &&
134-
needs.triage.outputs.triaged_issues != '[]'
116+
needs.triage.outputs.triaged_issues != ''
135117
permissions:
136118
contents: 'read'
137119
issues: 'write'
@@ -141,7 +123,7 @@ jobs:
141123
id: 'mint_identity_token'
142124
if: |-
143125
${{ vars.APP_ID }}
144-
uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2
126+
uses: 'actions/create-github-app-token@v2'
145127
with:
146128
app-id: '${{ vars.APP_ID }}'
147129
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
@@ -153,56 +135,30 @@ jobs:
153135
env:
154136
AVAILABLE_LABELS: '${{ needs.triage.outputs.available_labels }}'
155137
TRIAGED_ISSUES: '${{ needs.triage.outputs.triaged_issues }}'
156-
uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8.0.0
138+
uses: 'actions/github-script@v7'
157139
with:
158-
# Use the provided token so that the "gemini-cli" is the actor in the
159-
# log for what changed the labels.
160140
github-token: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN || github.token }}'
161141
script: |-
162-
// Parse the available labels
163142
const availableLabels = (process.env.AVAILABLE_LABELS || '').split(',')
164143
.map((label) => label.trim())
165144
.sort()
166145
167-
// Parse out the triaged issues
168146
const triagedIssues = (JSON.parse(process.env.TRIAGED_ISSUES || '{}'))
169-
.sort((a, b) => a.issue_number - b.issue_number)
170-
171-
core.debug(`Triaged issues: ${JSON.stringify(triagedIssues)}`);
172147
173-
// Iterate over each label
174148
for (const issue of triagedIssues) {
175-
if (!issue) {
176-
core.debug(`Skipping empty issue: ${JSON.stringify(issue)}`);
177-
continue;
178-
}
149+
if (!issue || !issue.issue_number) continue;
179150
180-
const issueNumber = issue.issue_number;
181-
if (!issueNumber) {
182-
core.debug(`Skipping issue with no data: ${JSON.stringify(issue)}`);
183-
continue;
184-
}
185-
186-
// Extract and reject invalid labels - we do this just in case
187-
// someone was able to prompt inject malicious labels.
188151
let labelsToSet = (issue.labels_to_set || [])
189152
.map((label) => label.trim())
190153
.filter((label) => availableLabels.includes(label))
191154
.sort()
192155
193-
core.debug(`Identified labels to set: ${JSON.stringify(labelsToSet)}`);
194-
195-
if (labelsToSet.length === 0) {
196-
core.info(`Skipping issue #${issueNumber} - no labels to set.`)
197-
continue;
198-
}
199-
200-
core.debug(`Setting labels on issue #${issueNumber} to ${labelsToSet.join(', ')} (${issue.explanation || 'no explanation'})`)
156+
if (labelsToSet.length === 0) continue;
201157
202158
await github.rest.issues.setLabels({
203159
owner: context.repo.owner,
204160
repo: context.repo.repo,
205-
issue_number: issueNumber,
161+
issue_number: issue.issue_number,
206162
labels: labelsToSet,
207163
});
208164
}

0 commit comments

Comments
 (0)