mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
ci(.github/workflows/traiage.yaml): check instead for push access to repo (#20163)
This commit is contained in:
@@ -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 actor’s 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
|
||||
|
||||
Reference in New Issue
Block a user