Skip to content

Commit

Permalink
new way of chekcing auth
Browse files Browse the repository at this point in the history
  • Loading branch information
nikellepetrillo committed Jan 21, 2025
1 parent 2c4a165 commit 84d4aba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/authorized_users.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# In authorized_users.yml
name: Authorized Users

on:
Expand All @@ -22,7 +21,7 @@ jobs:
id: gatekeeper
run: |
echo "The actor is: ${GITHUB_ACTOR}"
APPROVED_USERS=("nikellepetrillo")
APPROVED_USERS=("nikellepetrillo") # Add more users as needed
if [[ " ${APPROVED_USERS[@]} " =~ " ${GITHUB_ACTOR} " ]]; then
echo "User ${GITHUB_ACTOR} is approved."
Expand All @@ -33,4 +32,4 @@ jobs:
echo "approved=false" >> $GITHUB_OUTPUT
echo "error-message=Unauthorized user: ${GITHUB_ACTOR}" >> $GITHUB_OUTPUT
exit 1
fi
fi
18 changes: 2 additions & 16 deletions .github/workflows/test_illumina_genotyping_array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,11 @@ env:

jobs:
check-authorization:
runs-on: ubuntu-latest
steps:
- name: Check Authorization
id: authorization
run: |
# Run the authorization script and set the result
AUTHORIZED_USERS=("nikellepetrilloo") # Replace with your list of authorized users
CURRENT_USER="${{ github.actor }}"
if [[ " ${AUTHORIZED_USERS[@]} " =~ " ${CURRENT_USER} " ]]; then
echo "approved=true" >> $GITHUB_OUTPUT
else
echo "approved=false" >> $GITHUB_OUTPUT
echo "::error::Authorization check failed - unauthorized user"
exit 1
fi
uses: ./.github/workflows/authorized_users.yml

TestIlluminaGenotypingArray:
needs: check-authorization
if: needs.check-authorization.result == 'success'
if: ${{ needs.check-authorization.outputs.approved == 'true' }
runs-on: ubuntu-latest
# Add "id-token" with the intended permissions.
permissions:
Expand Down

0 comments on commit 84d4aba

Please sign in to comment.