From ef1cb2e544b5a272179683f418332ba5b6e6f6ea Mon Sep 17 00:00:00 2001 From: Brian Pandola Date: Thu, 28 Jan 2021 07:19:30 -0800 Subject: [PATCH] Enable GitHub Actions to run successfully on forks (#3622) * Trigger workflow on any push or pull request. * Conditionally run Codecov Upload and Deploy *only* on `spulec/moto` repository. This allows contributors to get CI results on their forked repo before submitting PRs to `moto`. Previously, forked repos could run the actions but would fail (rightfully) on the steps that should only be run on the main repo (and require tokens/secrets). --- .github/workflows/build.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 452669b5d..60c49b9c0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,6 @@ name: TestNDeploy -on: - push: - branches: - - master - pull_request: +on: [push, pull_request] jobs: # Install and cache dependencies @@ -119,7 +115,7 @@ jobs: run: | make test-coverage - name: "Upload coverage to Codecov" - if: ${{ matrix.python-version == 3.7 }} + if: ${{ matrix.python-version == 3.7 && github.repository == 'spulec/moto'}} uses: codecov/codecov-action@v1 with: fail_ci_if_error: true @@ -170,7 +166,7 @@ jobs: name: Deploy runs-on: ubuntu-latest needs: [test, testserver] - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'spulec/moto' }} strategy: matrix: python-version: [3.8]