Skip to content

Commit

Permalink
WIP: env
Browse files Browse the repository at this point in the history
  • Loading branch information
andykenward committed Mar 25, 2024
1 parent 14d3f9d commit 8fb05a8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 #v4.1.2
- id: 'cloudflare-pages'
uses: ./
env:
TEST_CUSTOM_ENV: '12345'
with:
cloudflare-api-token: ${{secrets.CLOUDFLARE_API_TOKEN}}
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/github/__mocks__/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {vi} from 'vitest'

import type {Environment} from '../environment.js'

export * from '../environment.js'

export const createEnvironment = vi.fn().mockResolvedValue({
name: 'unlike-dev (Preview)',
id: 'EN_kwDOJn0nrM5D_l8n',
Expand Down
6 changes: 6 additions & 0 deletions src/github/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,9 @@ export const checkEnvironment = async () => {
}

export type Environment = Awaited<ReturnType<typeof checkEnvironment>>

/* eslint-disable no-console */
export const getEnv = () => {
console.log('preview only test:', process.env['PREVIEW__ONLY_TEST'])
console.log('action env', process.env['TEST_CUSTOM_ENV'])
}
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import {deleteDeployments} from './delete.js'
import {addComment} from './github/comment.js'
import {useContext, useContextEvent} from './github/context.js'
import {createGitHubDeployment} from './github/deployment/create.js'
import {getEnv} from './github/environment.js'

export async function run() {
getEnv()
const {branch} = useContext()
const {eventName, payload} = useContextEvent()

Expand Down

0 comments on commit 8fb05a8

Please sign in to comment.