diff options
author | Adin Scannell <ascannell@google.com> | 2020-07-28 09:39:08 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-28 09:40:44 -0700 |
commit | a05ea20ef1107cc0a4ace94d6dffd7c7e590b264 (patch) | |
tree | e3a562c259e358bec1127ce4d01f16892b4bbe5c /.github/workflows | |
parent | 487b0905a4d21d8ca97013cab3f3c245d9241edc (diff) |
Don't attempt to use the secret if it does not exist.
Fixes #3326
PiperOrigin-RevId: 323589669
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/go.yml | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 10c86f5cd..a81d06cca 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 |