-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding app-name-matcher to Action params #57
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6a61724
Adding app-name-matcher to Action params
karoun 68b0654
Expanding README example
karoun 5d695bb
Splitting Actions
karoun b529dcd
Re-adding build Action
karoun b7e9805
Marking generated code
karoun e8bd7a4
Adding .env example
karoun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulled into separate CI step so it can pass and be required by GitHub Branch Protection Rules