Skip to content

Commit a209c85

Browse files
committed
Allow PR token fallback
1 parent 52795a9 commit a209c85

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/promote-nsc-channel.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ jobs:
217217
env:
218218
GH_BUILTIN_TOKEN: ${{ github.token }}
219219
PR_PAT: ${{ secrets.PR_PAT }}
220+
READ_PAT: ${{ secrets.READ_PAT }}
221+
CR_PAT: ${{ secrets.CR_PAT }}
220222
PR_BRANCH: ${{ steps.source-run.outputs.pr_branch }}
221223
RELEASE_TAG: ${{ steps.source-run.outputs.release_tag }}
222224
SOURCE_SHA: ${{ steps.source-run.outputs.source_sha }}
@@ -228,11 +230,18 @@ jobs:
228230
export GH_TOKEN="${GH_BUILTIN_TOKEN}"
229231
pr_head="${PR_BRANCH}"
230232
else
231-
if [[ -z "${PR_PAT}" ]]; then
232-
echo "PR_PAT secret is required when opening a PR from ${HEAD_REPO} to ${TARGET_REPO}" >&2
233+
pr_token="${PR_PAT}"
234+
if [[ -z "${pr_token}" ]]; then
235+
pr_token="${READ_PAT}"
236+
fi
237+
if [[ -z "${pr_token}" ]]; then
238+
pr_token="${CR_PAT}"
239+
fi
240+
if [[ -z "${pr_token}" ]]; then
241+
echo "A token with pull request write access is required when opening a PR from ${HEAD_REPO} to ${TARGET_REPO}" >&2
233242
exit 1
234243
fi
235-
export GH_TOKEN="${PR_PAT}"
244+
export GH_TOKEN="${pr_token}"
236245
pr_head="${HEAD_OWNER}:${PR_BRANCH}"
237246
fi
238247

0 commit comments

Comments
 (0)