-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding app-name-matcher to Action params (#57)
* Adding app-name-matcher to Action params * Expanding README example * Splitting Actions * Re-adding build Action * Marking generated code * Adding .env example
- Loading branch information
Showing
9 changed files
with
481 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Do not commit your actual .env file to Git! This may contain secrets or other | ||
# private information. | ||
|
||
# Enable/disable step debug logging (default: `false`). For local debugging, it | ||
# may be useful to set it to `true`. | ||
ACTIONS_STEP_DEBUG=true | ||
|
||
# GitHub Actions inputs should follow `INPUT_<name>` format (case-sensitive). | ||
# Hyphens should not be converted to underscores! | ||
# INPUT_MILLISECONDS=2400 | ||
|
||
# GitHub Actions default environment variables. These are set for every run of a | ||
# workflow and can be used in your actions. Setting the value here will override | ||
# any value set by the local-action tool. | ||
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | ||
|
||
# CI="true" | ||
# GITHUB_ACTION="" | ||
# GITHUB_ACTION_PATH="" | ||
# GITHUB_ACTION_REPOSITORY="" | ||
# GITHUB_ACTIONS="" | ||
# GITHUB_ACTOR="" | ||
# GITHUB_ACTOR_ID="" | ||
# GITHUB_API_URL="" | ||
# GITHUB_BASE_REF="" | ||
# GITHUB_ENV="" | ||
# GITHUB_EVENT_NAME="" | ||
# GITHUB_EVENT_PATH="" | ||
# GITHUB_GRAPHQL_URL="" | ||
# GITHUB_HEAD_REF="" | ||
# GITHUB_JOB="" | ||
# GITHUB_OUTPUT="" | ||
# GITHUB_PATH="" | ||
# GITHUB_REF="" | ||
# GITHUB_REF_NAME="" | ||
# GITHUB_REF_PROTECTED="" | ||
# GITHUB_REF_TYPE="" | ||
# GITHUB_REPOSITORY="" | ||
# GITHUB_REPOSITORY_ID="" | ||
# GITHUB_REPOSITORY_OWNER="" | ||
# GITHUB_REPOSITORY_OWNER_ID="" | ||
# GITHUB_RETENTION_DAYS="" | ||
# GITHUB_RUN_ATTEMPT="" | ||
# GITHUB_RUN_ID="" | ||
# GITHUB_RUN_NUMBER="" | ||
# GITHUB_SERVER_URL="" | ||
# GITHUB_SHA="" | ||
# GITHUB_STEP_SUMMARY="" | ||
# GITHUB_TRIGGERING_ACTOR="" | ||
# GITHUB_WORKFLOW="" | ||
# GITHUB_WORKFLOW_REF="" | ||
# GITHUB_WORKFLOW_SHA="" | ||
# GITHUB_WORKSPACE="" | ||
# RUNNER_ARCH="" | ||
# RUNNER_DEBUG="" | ||
# RUNNER_NAME="" | ||
# RUNNER_OS="" | ||
# RUNNER_TEMP="" | ||
# RUNNER_TOOL_CACHE="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
|
||
dist/** -diff linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "build" | ||
on: # rebuild any PRs and main branch changes | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- 'releases/*' | ||
|
||
jobs: | ||
build: # make sure build/ci work properly | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
npm install | ||
npm run all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,44 @@ | ||
import os from 'os'; | ||
import { run, filterAppsByName, type App } from '../src/main'; | ||
|
||
describe('main', () => { | ||
describe('Action', () => { | ||
// shows how the runner will run a javascript action with env / stdout protocol | ||
test('test runs', async () => { | ||
test('runs', async () => { | ||
process.env['RUNNER_TEMP'] = os.tmpdir(); | ||
process.env['GITHUB_REPOSITORY'] = 'quizlet/cd-infra'; | ||
process.env['INPUT_GITHUB-TOKEN'] = '500'; | ||
process.env['INPUT_ARGOCD-VERSION'] = 'v1.6.1'; | ||
process.env['INPUT_ARGOCD-SERVER-URL'] = 'argocd.qzlt.io'; | ||
process.env['INPUT_ARGOCD-TOKEN'] = 'foo'; | ||
expect(import('../src/main')).resolves.toBeTruthy(); | ||
expect(run()).rejects.toThrow(); | ||
}); | ||
|
||
describe('matches app names', () => { | ||
const makeApp = (name: string) => ({ metadata: { name } }) as App; | ||
|
||
test('allows all apps when matcher is empty', () => { | ||
expect(filterAppsByName([makeApp('foobar'), makeApp('bazqux')], '')).toEqual([ | ||
makeApp('foobar'), | ||
makeApp('bazqux') | ||
]); | ||
}); | ||
|
||
test('allows only apps when matcher is provided', () => { | ||
expect(filterAppsByName([makeApp('foobar'), makeApp('bazqux')], 'foobar')).toEqual([ | ||
makeApp('foobar') | ||
]); | ||
}); | ||
|
||
test('treats matcher as regex when it is delimited by slashes', () => { | ||
expect(filterAppsByName([makeApp('foobar'), makeApp('bazqux')], '/bar$/')).toEqual([ | ||
makeApp('foobar') | ||
]); | ||
}); | ||
|
||
test('with negative lookahead in regex', () => { | ||
expect(filterAppsByName([makeApp('foobar'), makeApp('bazqux')], '/^(?!foobar$).*$/')).toEqual( | ||
[makeApp('bazqux')] | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.