Don't attempt to use the secret if it does not exist.

Fixes #3326

PiperOrigin-RevId: 323589669
This commit is contained in:
Adin Scannell 2020-07-28 09:39:08 -07:00 committed by gVisor bot
parent 487b0905a4
commit a05ea20ef1
1 changed files with 9 additions and 3 deletions

View File

@ -11,7 +11,13 @@ jobs:
generate:
runs-on: ubuntu-latest
steps:
- run: |
- id: setup
run: |
if ! [[ -z "${{ secrets.GO_TOKEN }}" ]]; then
echo ::set-output has_token=true
else
echo ::set-output has_token=false
fi
jq -nc '{"state": "pending", "context": "go tests"}' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
@ -19,12 +25,12 @@ jobs:
"${{ github.event.pull_request.statuses_url }}"
if: github.event_name == 'pull_request'
- uses: actions/checkout@v2
if: github.event_name == 'push'
if: github.event_name == 'push' && steps.setup.outputs.has_token == 'true'
with:
fetch-depth: 0
token: '${{ secrets.GO_TOKEN }}'
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' || steps.setup.outputs.has_token != 'true'
with:
fetch-depth: 0
- uses: actions/setup-go@v2