-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from dependabot/parse-inputs
Initial commit: parse inputs
- Loading branch information
Showing
12 changed files
with
15,356 additions
and
10,829 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,61 @@ | ||
| import {Context} from '@actions/github/lib/context' | ||
| import {getInputs, DISPATCH_EVENT_NAME} from '../src/inputs' | ||
|
|
||
| test('raises error on issue_comment', () => { | ||
| const ctx = new Context() | ||
| ctx.eventName = 'issue_comment' | ||
|
|
||
| expect(getInputs(ctx)).toBeNull | ||
| }) | ||
|
|
||
| test('loads repository_dispatch', () => { | ||
| const ctx = new Context() | ||
| ctx.eventName = 'repository_dispatch' | ||
| ctx.payload = { | ||
| action: DISPATCH_EVENT_NAME, | ||
| client_payload: { | ||
| jobID: 1, | ||
| jobToken: 'xxx', | ||
| credentialsToken: 'yyy' | ||
| } | ||
| } | ||
|
|
||
| const inputs = getInputs(ctx) | ||
| expect(inputs?.jobID).toEqual(1) | ||
| expect(inputs?.jobToken).toEqual('xxx') | ||
| expect(inputs?.credentialsToken).toEqual('yyy') | ||
| }) | ||
|
|
||
| test('loads dynamic', () => { | ||
| const ctx = new Context() | ||
| ctx.eventName = 'dynamic' | ||
| ctx.payload = { | ||
| inputs: { | ||
| jobID: 1, | ||
| jobToken: 'xxx', | ||
| credentialsToken: 'yyy' | ||
| } | ||
| } | ||
|
|
||
| const inputs = getInputs(ctx) | ||
| expect(inputs?.jobID).toEqual(1) | ||
| expect(inputs?.jobToken).toEqual('xxx') | ||
| expect(inputs?.credentialsToken).toEqual('yyy') | ||
| }) | ||
|
|
||
| test('loads workflow_dispatch', () => { | ||
| const ctx = new Context() | ||
| ctx.eventName = 'workflow_dispatch' | ||
| ctx.payload = { | ||
| inputs: { | ||
| jobID: '1', | ||
| jobToken: 'xxx', | ||
| credentialsToken: 'yyy' | ||
| } | ||
| } | ||
|
|
||
| const inputs = getInputs(ctx) | ||
| expect(inputs?.jobID).toEqual(1) | ||
| expect(inputs?.jobToken).toEqual('xxx') | ||
| expect(inputs?.credentialsToken).toEqual('yyy') | ||
| }) |
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,11 +1,6 @@ | ||
| name: 'Your name here' | ||
| name: 'Updater Action' | ||
| description: 'Provide a description here' | ||
| author: 'Your name or organization here' | ||
| inputs: | ||
| milliseconds: # change this | ||
| required: true | ||
| description: 'input description here' | ||
| default: 'default value if applicable' | ||
| runs: | ||
| using: 'node12' | ||
| main: 'dist/index.js' |
Oops, something went wrong.