Skip to content

Commit 3cd04ea

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/npm-dependencies-9562665640
2 parents 0590682 + 722d2ce commit 3cd04ea

File tree

6 files changed

+35
-5
lines changed

6 files changed

+35
-5
lines changed

.github/workflows/actions-config-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v4
1818

1919
- name: actions-config-validation
20-
uses: GrantBirki/json-yaml-validate@e42e6ece9b97f2b220274c909a9a98e380c2c9fd # pin@v3.2.1
20+
uses: GrantBirki/json-yaml-validate@947ae8ac60c83cf78e4e00b3170ff8bee61f5248 # pin@v3.3.0
2121
with:
2222
comment: "true" # enable comment mode
2323
yaml_schema: "__tests__/schemas/action.schema.yml"

__tests__/functions/post.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,33 @@ test('throws an error', async () => {
9797
expect(setFailedMock).toHaveBeenCalledWith('test error')
9898
}
9999
})
100+
101+
test('use reaction specified in input on success', async () => {
102+
const reactionInput = {
103+
status: 'success',
104+
success_reaction: 'rocket'
105+
}
106+
jest.spyOn(core, 'getInput').mockImplementation(name => {
107+
return reactionInput[name]
108+
})
109+
const postReactionsMock = jest.spyOn(postReactions, 'postReactions')
110+
111+
expect(await post()).toBeUndefined()
112+
expect(postReactionsMock).toHaveBeenCalled()
113+
expect(postReactionsMock.mock.calls[0][2]).toBe('rocket')
114+
})
115+
116+
test('use reaction specified in input on failure', async () => {
117+
const reactionInput = {
118+
status: 'failure',
119+
failure_reaction: 'confused'
120+
}
121+
jest.spyOn(core, 'getInput').mockImplementation(name => {
122+
return reactionInput[name]
123+
})
124+
const postReactionsMock = jest.spyOn(postReactions, 'postReactions')
125+
126+
expect(await post()).toBeUndefined()
127+
expect(postReactionsMock).toHaveBeenCalled()
128+
expect(postReactionsMock.mock.calls[0][2]).toBe('confused')
129+
})

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions/post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function post() {
5858
if (success) {
5959
reaction = core.getInput('success_reaction') || thumbsUp
6060
} else {
61-
reaction = core.getInput('failed_reaction') || thumbsDown
61+
reaction = core.getInput('failure_reaction') || thumbsDown
6262
}
6363

6464
// Update the reactions on the command comment

0 commit comments

Comments
 (0)