Skip to content

Commit 3d9cfb0

Browse files
committed
hopeful fix for file not commiting
1 parent 9381d60 commit 3d9cfb0

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

.github/workflows/trademark-cla-approval.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
id: process-comment
2525
uses: actions/github-script@v7
2626
with:
27-
github-token: ${{ steps.generate-token.outputs.token }}
27+
github-token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
2828
script: |
2929
// Only process comments on pull requests
3030
if (!context.payload.issue.pull_request) {
@@ -141,6 +141,7 @@ jobs:
141141
core.setOutput('pr_number', prNumber);
142142
core.setOutput('pr_author', prAuthor);
143143
core.setOutput('approved_by', prAuthor);
144+
core.setOutput('pr_head_sha', pr.head.sha);
144145
145146
// Add confirmation comment
146147
const confirmationBody = [
@@ -169,7 +170,9 @@ jobs:
169170
uses: actions/checkout@v4
170171
with:
171172
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 }}
173176

174177
- name: Record signature to file
175178
if: success() && steps.process-comment.outputs.pr_number != ''
@@ -178,6 +181,13 @@ jobs:
178181
179182
echo "=== Recording signature immediately after label addition ==="
180183
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+
181191
# Get signature details
182192
USERNAME="${{ steps.process-comment.outputs.pr_author }}"
183193
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
@@ -206,6 +216,7 @@ jobs:
206216
207217
if [ -z "$EXISTING" ]; then
208218
# Add new signature
219+
echo "Adding signature to file..."
209220
jq --arg user "$USERNAME" \
210221
--arg date "$DATE" \
211222
--arg pr "$PR_NUMBER" \
@@ -218,6 +229,8 @@ jobs:
218229
}]' "$SIGNATURES_FILE" > tmp.json && mv tmp.json "$SIGNATURES_FILE"
219230
220231
echo "✅ Added signature for $USERNAME"
232+
echo "File contents after update:"
233+
cat "$SIGNATURES_FILE"
221234
else
222235
echo "ℹ️ Signature already exists for $USERNAME on PR #$PR_NUMBER"
223236
fi
@@ -226,13 +239,22 @@ jobs:
226239
git config user.name "github-actions[bot]"
227240
git config user.email "github-actions[bot]@users.noreply.github.com"
228241
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
232254
git commit -m "Add trademark addendum signature for @$USERNAME (PR #$PR_NUMBER)" \
233255
-m "This signature was recorded automatically by the CLA approval workflow."
234256
git push
235257
echo "✅ Signature committed and pushed successfully"
236258
else
237-
echo "ℹ️ No changes to commit"
259+
echo "ℹ️ No staged changes to commit"
238260
fi

0 commit comments

Comments
 (0)