Skip to content

Commit 2c62230

Browse files
committed
fix
1 parent 58b8e38 commit 2c62230

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/trademark-cla.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ on:
66
issue_comment:
77
types: [created, edited]
88

9+
# Set repository-level permissions
910
permissions: write-all
1011

1112
jobs:
1213
enforce-docs-cla:
1314
runs-on: ubuntu-latest
15+
# Job-level permissions (inherits from above but can be more restrictive)
1416
permissions: write-all
1517

1618
steps:
@@ -29,21 +31,38 @@ jobs:
2931
echo "WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY is set"
3032
fi
3133
34+
if [ -z "${{ secrets.GITHUB_PAT }}" ]; then
35+
echo "GITHUB_PAT is empty or not set"
36+
else
37+
echo "GITHUB_PAT is set"
38+
fi
3239
echo "==================="
3340
3441
- name: Generate Token
3542
id: generate-token
43+
continue-on-error: true
3644
uses: actions/create-github-app-token@v1
3745
with:
3846
app-id: "${{ secrets.WORKFLOW_AUTH_PUBLIC_APP_ID }}"
3947
private-key: "${{ secrets.WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY }}"
4048

49+
- name: Debug - Token generation result
50+
run: |
51+
echo "=== TOKEN GENERATION RESULT ==="
52+
echo "Token step outcome: ${{ steps.generate-token.outcome }}"
53+
if [ "${{ steps.generate-token.outcome }}" = "success" ]; then
54+
echo "GitHub App token generated successfully"
55+
else
56+
echo "GitHub App token generation failed - will use GITHUB_TOKEN"
57+
fi
58+
echo "================================="
59+
4160
- name: Check out code
4261
uses: actions/checkout@v4
4362
with:
4463
fetch-depth: 0
45-
# Use the GitHub App token
46-
token: ${{ steps.generate-token.outputs.token }}
64+
# Use the GitHub App token if available, otherwise fallback to GITHUB_TOKEN
65+
token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
4766

4867
- name: Check if docs changed
4968
id: docs-changed
@@ -118,7 +137,7 @@ jobs:
118137
(github.event_name == 'issue_comment' && steps.pr-info.outputs.has_docs_changes == 'true'))
119138
uses: actions/github-script@v7
120139
with:
121-
github-token: ${{ secrets.CLA_BOT_TOKEN }}
140+
github-token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
122141
script: |
123142
let prNumber, prAuthor;
124143
@@ -248,7 +267,7 @@ jobs:
248267
(github.event_name == 'issue_comment' && steps.pr-info.outputs.has_docs_changes == 'true'))
249268
uses: actions/github-script@v7
250269
with:
251-
github-token: ${{ secrets.CLA_BOT_TOKEN }}
270+
github-token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
252271
script: |
253272
let prNumber, prHeadSha, prAuthor;
254273

0 commit comments

Comments
 (0)