ci(.github/workflows/traiage.yaml): check instead for push access to repo (#20163)

This commit is contained in:
Cian Johnston
2025-10-03 15:04:20 +01:00
committed by GitHub
parent 2b4485575c
commit a360785199
+6 -7
View File
@@ -110,20 +110,19 @@ jobs:
exit 1
fi
- name: Verify organization membership
- name: Verify push access
env:
GITHUB_ORG: ${{ github.repository_owner }}
GITHUB_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GITHUB_USERNAME: ${{ steps.determine-inputs.outputs.github_username }}
GITHUB_USER_ID: ${{ steps.determine-inputs.outputs.github_user_id }}
run: |
# Check if the actor is a member of the organization
if ! gh api "orgs/${GITHUB_ORG}/members/${GITHUB_USERNAME}" --silent 2>/dev/null; then
echo "::error title=Access Denied::User ${GITHUB_USERNAME} is not a member of the ${GITHUB_ORG} organization"
echo "::error::You must be a member of the ${GITHUB_ORG} GitHub organization to run this workflow."
# Query the actors permission on this repo
can_push="$(gh api "/repos/${GITHUB_REPOSITORY}/collaborators/${GITHUB_USERNAME}/permission" --jq '.user.permissions.push')"
if [[ "${can_push}" != "true" ]]; then
echo "::error title=Access Denied::${GITHUB_USERNAME} does not have push access to ${GITHUB_REPOSITORY}"
exit 1
fi
echo "::notice::User ${GITHUB_USERNAME} verified as member of ${GITHUB_ORG} organization"
- name: Extract context key from issue
id: extract-context