Browse Source

Check for secrets before using them (#167)

* Check for secrets before using them

* Test all the appropriate branches
pull/169/head
Matt Bishop 1 year ago committed by GitHub
parent
commit
7eec009f41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 32
      .github/workflows/test.yml

32
.github/workflows/test.yml

@ -1,17 +1,42 @@ @@ -1,17 +1,42 @@
name: Test
name: Testing
on:
workflow_dispatch:
push:
branches:
- "main"
- "rc"
- "hotfix-rc"
pull_request:
jobs:
test:
check-test-secrets:
name: Check for test secrets
runs-on: ubuntu-22.04
outputs:
available: ${{ steps.check-test-secrets.outputs.available }}
permissions:
contents: read
steps:
- name: Check
id: check-test-secrets
run: |
if [ "${{ secrets.CODECOV_TOKEN }}" != '' ]; then
echo "available=true" >> $GITHUB_OUTPUT;
else
echo "available=false" >> $GITHUB_OUTPUT;
fi
testing:
name: Run tests
if: ${{ startsWith(github.head_ref, 'version_bump_') == false }}
runs-on: ubuntu-22.04
needs: check-test-secrets
permissions:
checks: write
contents: read
pull-requests: write
steps:
- name: Check out repo
@ -25,7 +50,7 @@ jobs: @@ -25,7 +50,7 @@ jobs:
- name: Report test results
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
if: always()
if: ${{ needs.check-test-secrets.outputs.available == 'true' && !cancelled() }}
with:
name: Test Results
path: "**/test-results.trx"
@ -34,5 +59,6 @@ jobs: @@ -34,5 +59,6 @@ jobs:
- name: Upload to codecov.io
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
if: ${{ needs.check-test-secrets.outputs.available == 'true' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Loading…
Cancel
Save