Skip to content

Commit a4ae690

Browse files
committed
ci: Don't run internal steps if forked
This was causing CI to fail for contributions.
1 parent a13ccee commit a4ae690

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/workflows/chromatic.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
# SEE: https://www.chromatic.com/docs/ci
77
name: chromatic
88

9-
# Chromatic works best with push events, not pull_request or other event types.
10-
on: push
9+
on:
10+
push:
11+
branches:
12+
- main
13+
tags:
14+
- "*"
15+
16+
pull_request:
1117

1218
jobs:
1319
deploy:

.github/workflows/coder.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ jobs:
184184
-timeout=3m -count=$GOCOUNT -short -failfast
185185

186186
- name: Upload DataDog Trace
187-
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
187+
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
188188
env:
189189
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
190190
DD_DATABASE: fake
@@ -193,7 +193,7 @@ jobs:
193193
run: go run scripts/datadog-cireport/main.go gotests.xml
194194

195195
- uses: codecov/codecov-action@v3
196-
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
196+
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
197197
with:
198198
token: ${{ secrets.CODECOV_TOKEN }}
199199
files: ./gotests.coverage
@@ -271,15 +271,15 @@ jobs:
271271
-count=1 -parallel=2 -race -failfast
272272

273273
- name: Upload DataDog Trace
274-
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
274+
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
275275
env:
276276
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
277277
DD_DATABASE: postgresql
278278
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
279279
run: go run scripts/datadog-cireport/main.go gotests.xml
280280

281281
- uses: codecov/codecov-action@v3
282-
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
282+
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
283283
with:
284284
token: ${{ secrets.CODECOV_TOKEN }}
285285
files: ./gotests.coverage
@@ -290,7 +290,7 @@ jobs:
290290
name: "deploy"
291291
runs-on: ubuntu-latest
292292
timeout-minutes: 20
293-
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
293+
if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
294294
permissions:
295295
contents: read
296296
id-token: write
@@ -396,15 +396,15 @@ jobs:
396396
working-directory: site
397397

398398
- uses: codecov/codecov-action@v3
399-
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
399+
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
400400
with:
401401
token: ${{ secrets.CODECOV_TOKEN }}
402402
files: ./site/coverage/lcov.info
403403
flags: unittest-js
404404
fail_ci_if_error: true
405405

406406
- name: Upload DataDog Trace
407-
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
407+
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
408408
env:
409409
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
410410
DD_CATEGORY: unit
@@ -485,7 +485,7 @@ jobs:
485485
working-directory: site
486486

487487
- name: Upload DataDog Trace
488-
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.repository_owner == 'coder'
488+
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
489489
env:
490490
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
491491
DD_CATEGORY: e2e

0 commit comments

Comments
 (0)