Merge pull request #794 from strukturag/ci-build-if-token-exists

CI: Only build code if token exists (i.e. with Dependabot).
This commit is contained in:
Joachim Bauch 2024-07-31 11:40:23 +02:00 committed by GitHub
commit eec3af2e01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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