diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/go.yml | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 60704f144..10c86f5cd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,7 +17,14 @@ jobs: -H "Content-Type: application/json" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ "${{ github.event.pull_request.statuses_url }}" + if: github.event_name == 'pull_request' - uses: actions/checkout@v2 + if: github.event_name == 'push' + with: + fetch-depth: 0 + token: '${{ secrets.GO_TOKEN }}' + - uses: actions/checkout@v2 + if: github.event_name == 'pull_request' with: fetch-depth: 0 - uses: actions/setup-go@v2 @@ -41,20 +48,16 @@ jobs: - run: go build ./... - if: github.event_name == 'push' run: | - # Required dedicated credentials for the Go branch, due to the way - # branch protection rules are configured. - git config --global credential.helper cache - echo -e "protocol=https\nhost=github.com\nusername=${{ secrets.GO_TOKEN }}\npassword=x-oauth-basic" | git credential approve git remote add upstream "https://github.com/${{ github.repository }}" git push upstream go:go - - if: ${{ success() }} + - if: ${{ success() && github.event_name == 'pull_request' }} run: | jq -nc '{"state": "success", "context": "go tests"}' | \ curl -sL -X POST -d @- \ -H "Content-Type: application/json" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ "${{ github.event.pull_request.statuses_url }}" - - if: ${{ failure() }} + - if: ${{ failure() && github.event_name == 'pull_request' }} run: | jq -nc '{"state": "failure", "context": "go tests"}' | \ curl -sL -X POST -d @- \ |