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).
This commit is contained in:
parent
e2e107e555
commit
ef1cb2e544
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@ -1,10 +1,6 @@
|
|||||||
name: TestNDeploy
|
name: TestNDeploy
|
||||||
|
|
||||||
on:
|
on: [push, pull_request]
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Install and cache dependencies
|
# Install and cache dependencies
|
||||||
@ -119,7 +115,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make test-coverage
|
make test-coverage
|
||||||
- name: "Upload coverage to Codecov"
|
- 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
|
uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
@ -170,7 +166,7 @@ jobs:
|
|||||||
name: Deploy
|
name: Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test, testserver]
|
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:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.8]
|
python-version: [3.8]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user