Skip to content

Commit

Permalink
CI: Only build code if token exists (i.e. with Dependabot).
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Jul 31, 2024
1 parent 6d4b8e7 commit 5d851b8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,27 @@ permissions:
contents: read

jobs:
check-token:
runs-on: ubuntu-latest
outputs:
token-exists: ${{ steps.token-check.outputs.defined }}
steps:
- name: Check for Token availability
id: token-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.CODE_GENERATOR_PAT }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
build:
if: ${{ github.event_name == 'pull_request' }}
name: build
runs-on: ubuntu-latest
needs: [check-token]
if: ${{ github.event_name == 'pull_request' && needs.check-token.outputs.token-exists == 'true' }}
permissions:
contents: write
continue-on-error: true
Expand Down

0 comments on commit 5d851b8

Please sign in to comment.