Skip to content

Commit

Permalink
add permission check to test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tr4nt0r committed Feb 14, 2024
1 parent b3fa9de commit a3667cb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,36 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
- uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v5.0.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Run tests
run: |
if [[ "x${{ secrets.PASSWORD }}" != "x" ]]; then
echo "Access to secrets"
else
echo "No access to secrets"
exit 1
fi
- run: pip install -r requirements.txt
- run: pip install python-dotenv
- run: python test.py
Expand Down

0 comments on commit a3667cb

Please sign in to comment.