24
24
id : process-comment
25
25
uses : actions/github-script@v7
26
26
with :
27
- github-token : ${{ steps.generate-token.outputs.token }}
27
+ github-token : ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
28
28
script : |
29
29
// Only process comments on pull requests
30
30
if (!context.payload.issue.pull_request) {
@@ -141,6 +141,7 @@ jobs:
141
141
core.setOutput('pr_number', prNumber);
142
142
core.setOutput('pr_author', prAuthor);
143
143
core.setOutput('approved_by', prAuthor);
144
+ core.setOutput('pr_head_sha', pr.head.sha);
144
145
145
146
// Add confirmation comment
146
147
const confirmationBody = [
@@ -169,7 +170,9 @@ jobs:
169
170
uses : actions/checkout@v4
170
171
with :
171
172
fetch-depth : 0
172
- token : ${{ steps.generate-token.outputs.token }}
173
+ # For issue_comment events, checkout the PR head
174
+ ref : ${{ steps.process-comment.outputs.pr_head_sha }}
175
+ token : ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
173
176
174
177
- name : Record signature to file
175
178
if : success() && steps.process-comment.outputs.pr_number != ''
@@ -178,6 +181,13 @@ jobs:
178
181
179
182
echo "=== Recording signature immediately after label addition ==="
180
183
184
+ # Debug: Check current working directory and branch
185
+ echo "=== Debug Info ==="
186
+ pwd
187
+ echo "Current branch: $(git branch --show-current)"
188
+ echo "Git remote: $(git remote -v)"
189
+ ls -la contribute/ 2>/dev/null || echo "contribute/ directory does not exist"
190
+
181
191
# Get signature details
182
192
USERNAME="${{ steps.process-comment.outputs.pr_author }}"
183
193
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
@@ -206,6 +216,7 @@ jobs:
206
216
207
217
if [ -z "$EXISTING" ]; then
208
218
# Add new signature
219
+ echo "Adding signature to file..."
209
220
jq --arg user "$USERNAME" \
210
221
--arg date "$DATE" \
211
222
--arg pr "$PR_NUMBER" \
@@ -218,6 +229,8 @@ jobs:
218
229
}]' "$SIGNATURES_FILE" > tmp.json && mv tmp.json "$SIGNATURES_FILE"
219
230
220
231
echo "✅ Added signature for $USERNAME"
232
+ echo "File contents after update:"
233
+ cat "$SIGNATURES_FILE"
221
234
else
222
235
echo "ℹ️ Signature already exists for $USERNAME on PR #$PR_NUMBER"
223
236
fi
@@ -226,13 +239,22 @@ jobs:
226
239
git config user.name "github-actions[bot]"
227
240
git config user.email "github-actions[bot]@users.noreply.github.com"
228
241
229
- # Check if there are changes and commit
230
- if ! git diff --quiet "$SIGNATURES_FILE"; then
231
- git add "$SIGNATURES_FILE"
242
+ # Debug: Check git status
243
+ echo "=== Git status ==="
244
+ git status
245
+
246
+ echo "=== Git diff ==="
247
+ git diff "$SIGNATURES_FILE"
248
+
249
+ # Add the file to git and commit
250
+ git add "$SIGNATURES_FILE"
251
+
252
+ # Check if there are staged changes
253
+ if ! git diff --cached --quiet; then
232
254
git commit -m "Add trademark addendum signature for @$USERNAME (PR #$PR_NUMBER)" \
233
255
-m "This signature was recorded automatically by the CLA approval workflow."
234
256
git push
235
257
echo "✅ Signature committed and pushed successfully"
236
258
else
237
- echo "ℹ️ No changes to commit"
259
+ echo "ℹ️ No staged changes to commit"
238
260
fi
0 commit comments