Skip to content

Commit 514921e

Browse files
committed
ci: Enable forks to run CI
All steps that require tokens are optional for forks, and will be skipped if the owner is not "coder".
1 parent c1ff537 commit 514921e

File tree

3 files changed

+13
-118
lines changed

3 files changed

+13
-118
lines changed

.github/workflows/chromatic.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ jobs:
3333
with:
3434
buildScriptName: "storybook:build"
3535
exitOnceUploaded: true
36-
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
36+
# Chromatic states its fine to make this token public. See:
37+
# https://www.chromatic.com/docs/github-actions#forked-repositories
38+
projectToken: 695c25b6cb65
3739
workingDir: "./site"
3840

3941
# This is a separate step for mainline only that auto accepts and changes
@@ -48,5 +50,5 @@ jobs:
4850
with:
4951
autoAcceptChanges: true
5052
buildScriptName: "storybook:build"
51-
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
53+
projectToken: 695c25b6cb65
5254
workingDir: "./site"

.github/workflows/coder-test-stability.yaml

-98
This file was deleted.

.github/workflows/coder.yaml

+9-18
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ name: coder
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- "release/*"
8-
tags:
9-
- "*"
10-
11-
pull_request:
12-
branches:
13-
- "*"
145

156
workflow_dispatch:
167

@@ -178,7 +169,7 @@ jobs:
178169
-timeout=3m -count=$GOCOUNT -short -failfast
179170

180171
- name: Upload DataDog Trace
181-
if: (success() || failure()) && github.actor != 'dependabot[bot]'
172+
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
182173
env:
183174
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
184175
DD_DATABASE: fake
@@ -187,7 +178,7 @@ jobs:
187178
run: go run scripts/datadog-cireport/main.go gotests.xml
188179

189180
- uses: codecov/codecov-action@v2
190-
if: github.actor != 'dependabot[bot]'
181+
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
191182
with:
192183
token: ${{ secrets.CODECOV_TOKEN }}
193184
files: ./gotests.coverage
@@ -264,25 +255,25 @@ jobs:
264255
-count=1 -parallel=2 -race -failfast
265256

266257
- name: Upload DataDog Trace
267-
if: (success() || failure()) && github.actor != 'dependabot[bot]'
258+
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
268259
env:
269260
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
270261
DD_DATABASE: postgresql
271262
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
272263
run: go run scripts/datadog-cireport/main.go gotests.xml
273264

274265
- uses: codecov/codecov-action@v2
275-
if: github.actor != 'dependabot[bot]'
266+
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
276267
with:
277268
token: ${{ secrets.CODECOV_TOKEN }}
278269
files: ./gotests.coverage
279270
flags: unittest-go-${{ matrix.os }}
280-
fail_ci_if_error: true
271+
fail_ci_if_error: ${{ github.repository_owner == 'coder' }}
281272

282273
deploy:
283274
name: "deploy"
284275
runs-on: ubuntu-latest
285-
if: github.ref == 'refs/heads/main'
276+
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
286277
permissions:
287278
contents: read
288279
id-token: write
@@ -391,15 +382,15 @@ jobs:
391382
working-directory: site
392383

393384
- uses: codecov/codecov-action@v2
394-
if: github.actor != 'dependabot[bot]'
385+
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
395386
with:
396387
token: ${{ secrets.CODECOV_TOKEN }}
397388
files: ./site/coverage/lcov.info
398389
flags: unittest-js
399390
fail_ci_if_error: true
400391

401392
- name: Upload DataDog Trace
402-
if: (success() || failure()) && github.actor != 'dependabot[bot]'
393+
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
403394
env:
404395
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
405396
DD_CATEGORY: unit
@@ -483,7 +474,7 @@ jobs:
483474
working-directory: site
484475

485476
- name: Upload DataDog Trace
486-
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux'
477+
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.repository_owner == 'coder'
487478
env:
488479
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
489480
DD_CATEGORY: e2e

0 commit comments

Comments
 (0)