Don't attempt to use the secret if it does not exist.
Fixes #3326 PiperOrigin-RevId: 323589669
This commit is contained in:
parent
487b0905a4
commit
a05ea20ef1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue