Skip to content

Commit

Permalink
Update build_loop.yml: skip Validate and Check permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornoleh authored Mar 25, 2024
1 parent 6cfd758 commit e6c5c9b
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/build_loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,10 @@ env:
ALIVE_BRANCH: alive

jobs:
validate:
name: Validate
uses: ./.github/workflows/validate_secrets.yml
secrets: inherit

# Checks if GH_PAT holds workflow permissions
# Checks for existence of alive branch; if non-existent creates it
check_alive_and_permissions:
needs: validate
runs-on: ubuntu-latest
name: Check alive branch and permissions
permissions:
Expand All @@ -34,21 +29,6 @@ jobs:
WORKFLOW_PERMISSION: ${{ steps.workflow-permission.outputs.has_permission }}

steps:
- name: Check for workflow permissions
id: workflow-permission
env:
TOKEN_TO_CHECK: ${{ secrets.GH_PAT }}
run: |
PERMISSIONS=$(curl -sS -f -I -H "Authorization: token ${{ env.TOKEN_TO_CHECK }}" https://api.github.com | grep ^x-oauth-scopes: | cut -d' ' -f2-);
if [[ $PERMISSIONS =~ "workflow" || $PERMISSIONS == "" ]]; then
echo "GH_PAT holds workflow permissions or is fine-grained PAT."
echo "has_permission=true" >> $GITHUB_OUTPUT # Set WORKFLOW_PERMISSION to false.
else
echo "GH_PAT lacks workflow permissions."
echo "Automated build features will be skipped!"
echo "has_permission=false" >> $GITHUB_OUTPUT # Set WORKFLOW_PERMISSION to false.
fi

- name: Check for alive branch
if: steps.workflow-permission.outputs.has_permission == 'true'
Expand Down Expand Up @@ -88,7 +68,7 @@ jobs:
# Checks for changes in upstream repository; if changes exist prompts sync for build
# Performs keepalive to avoid stale fork
check_latest_from_upstream:
needs: [validate, check_alive_and_permissions]
needs: [check_alive_and_permissions]
runs-on: ubuntu-latest
name: Check upstream and keep alive
outputs:
Expand Down

0 comments on commit e6c5c9b

Please sign in to comment.