Skip to content

Commit

Permalink
Allow builds in environments where secrets aren't available
Browse files Browse the repository at this point in the history
Refs 5888b0c
  • Loading branch information
thewilkybarkid committed Aug 8, 2024
1 parent 8f6bc41 commit 9922d0c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
name: 'Build dist'
runs-on: ubuntu-22.04
timeout-minutes: 30
if: github.ref == 'refs/heads/main'

steps:
- name: 'Checkout code'
Expand Down Expand Up @@ -53,6 +52,7 @@ jobs:
env:
PREREVIEW_REVIEWS_DATA_TOKEN: ${{ secrets.PREREVIEW_REVIEWS_DATA_TOKEN }}
FATHOM_TOKEN: ${{ secrets.FATHOM_TOKEN }}
SANDBOX: ${{ github.ref != 'refs/heads/main' }}

- name: 'Upload build'
uses: actions/[email protected]
Expand All @@ -64,7 +64,6 @@ jobs:
name: 'Build image'
runs-on: ubuntu-22.04
timeout-minutes: 30
if: github.ref == 'refs/heads/main' && !failure() && !cancelled()
outputs:
image: ${{ steps.build.outputs.imageid }}
needs:
Expand Down
6 changes: 6 additions & 0 deletions src/data/clubs.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ const Output = Schema.Record({ key: Schema.String, value: Schema.String })

const program = Effect.gen(function* () {
const terminal = yield* Terminal.Terminal
const sandbox = yield* Config.withDefault(Config.boolean('SANDBOX'), false)

if (sandbox) {
return yield* terminal.display('[]')
}

const token = yield* Config.redacted('PREREVIEW_REVIEWS_DATA_TOKEN')

const request = HttpClientRequest.bearerToken(
Expand Down
6 changes: 6 additions & 0 deletions src/data/reviews.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ const getLegacyReviews = Effect.gen(function* () {
})

const getReviews = Effect.gen(function* () {
const sandbox = yield* Config.withDefault(Config.boolean('SANDBOX'), false)

if (sandbox) {
return []
}

const token = yield* Config.redacted('PREREVIEW_REVIEWS_DATA_TOKEN')

const request = HttpClientRequest.bearerToken(
Expand Down
6 changes: 6 additions & 0 deletions src/data/users.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const Output = Schema.Array(

const program = Effect.gen(function* () {
const terminal = yield* Terminal.Terminal
const sandbox = yield* Config.withDefault(Config.boolean('SANDBOX'), false)

if (sandbox) {
return yield* terminal.display('[]')
}

const token = yield* Config.redacted('PREREVIEW_REVIEWS_DATA_TOKEN')

const request = HttpClientRequest.bearerToken(
Expand Down
6 changes: 6 additions & 0 deletions src/data/visitors-by-country.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const Output = Schema.Array(

const program = Effect.gen(function* () {
const terminal = yield* Terminal.Terminal
const sandbox = yield* Config.withDefault(Config.boolean('SANDBOX'), false)

if (sandbox) {
return yield* terminal.display('[]')
}

const token = yield* Config.redacted('FATHOM_TOKEN')

const request = HttpClientRequest.bearerToken(
Expand Down
6 changes: 6 additions & 0 deletions src/data/visitors-by-referrer.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const Output = Schema.Array(

const program = Effect.gen(function* () {
const terminal = yield* Terminal.Terminal
const sandbox = yield* Config.withDefault(Config.boolean('SANDBOX'), false)

if (sandbox) {
return yield* terminal.display('[]')
}

const token = yield* Config.redacted('FATHOM_TOKEN')

const request = HttpClientRequest.bearerToken(
Expand Down

0 comments on commit 9922d0c

Please sign in to comment.