From 6dedd0caacb5efd2b745453e34fd02bee387db92 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Sat, 16 Apr 2022 12:51:01 -0500 Subject: [PATCH] ci: Don't run internal steps if forked (#1048) This was causing CI to fail for contributions. --- .github/workflows/chromatic.yaml | 10 ++++++++-- .github/workflows/coder.yaml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/chromatic.yaml b/.github/workflows/chromatic.yaml index 298c389490..e824b320a4 100644 --- a/.github/workflows/chromatic.yaml +++ b/.github/workflows/chromatic.yaml @@ -6,8 +6,14 @@ # SEE: https://www.chromatic.com/docs/ci name: chromatic -# Chromatic works best with push events, not pull_request or other event types. -on: push +on: + push: + branches: + - main + tags: + - "*" + + pull_request: jobs: deploy: diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 917b072493..4bdce128b7 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -184,7 +184,7 @@ jobs: -timeout=3m -count=$GOCOUNT -short -failfast - name: Upload DataDog Trace - if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder' + if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} DD_DATABASE: fake @@ -193,7 +193,7 @@ jobs: run: go run scripts/datadog-cireport/main.go gotests.xml - uses: codecov/codecov-action@v3 - if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder' + if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork with: token: ${{ secrets.CODECOV_TOKEN }} files: ./gotests.coverage @@ -271,7 +271,7 @@ jobs: -count=1 -parallel=2 -race -failfast - name: Upload DataDog Trace - if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder' + if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} DD_DATABASE: postgresql @@ -279,7 +279,7 @@ jobs: run: go run scripts/datadog-cireport/main.go gotests.xml - uses: codecov/codecov-action@v3 - if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder' + if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork with: token: ${{ secrets.CODECOV_TOKEN }} files: ./gotests.coverage @@ -290,7 +290,7 @@ jobs: name: "deploy" runs-on: ubuntu-latest timeout-minutes: 20 - if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder' + if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork permissions: contents: read id-token: write @@ -396,7 +396,7 @@ jobs: working-directory: site - uses: codecov/codecov-action@v3 - if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder' + if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork with: token: ${{ secrets.CODECOV_TOKEN }} files: ./site/coverage/lcov.info @@ -404,7 +404,7 @@ jobs: fail_ci_if_error: true - name: Upload DataDog Trace - if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder' + if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} DD_CATEGORY: unit @@ -485,7 +485,7 @@ jobs: working-directory: site - name: Upload DataDog Trace - if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.repository_owner == 'coder' + if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} DD_CATEGORY: e2e