Skip to content

Commit f1ee2c0

Browse files
Merge pull request #288 from technote-space/release/next-v3.0.4
release: v3.1.0
2 parents 891935e + d1ba815 commit f1ee2c0

File tree

4 files changed

+253
-275
lines changed

4 files changed

+253
-275
lines changed

__tests__/context-helper.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import {testEnv, getContext} from '@technote-space/github-action-test-helper';
88
import {Logger, ContextHelper} from '../src';
99

10-
const {isRelease, isPush, isPr, isIssue, isCron, isCustomEvent, isCreateTag} = ContextHelper;
10+
const {isRelease, isPush, isPr, isIssue, isCron, isCustomEvent, isManualEvent, isCreateTag} = ContextHelper;
1111
const {getGitUrl, getRepository, getTagName, getSender, showActionInfo} = ContextHelper;
1212

1313
describe('isRelease', () => {
@@ -94,6 +94,20 @@ describe('isCustomEvent', () => {
9494
});
9595
});
9696

97+
describe('isManualEvent', () => {
98+
it('should return true', () => {
99+
expect(isManualEvent(getContext({
100+
eventName: 'workflow_dispatch',
101+
}))).toBe(true);
102+
});
103+
104+
it('should return false', () => {
105+
expect(isManualEvent(getContext({
106+
eventName: 'release',
107+
}))).toBe(false);
108+
});
109+
});
110+
97111
describe('isCreateTag', () => {
98112
it('should return true', () => {
99113
expect(isCreateTag(getContext({

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@technote-space/github-action-helper",
3-
"version": "3.0.4",
3+
"version": "3.1.0",
44
"description": "Helper to filter GitHub Action.",
55
"author": {
66
"name": "Technote",
@@ -28,25 +28,25 @@
2828
"dependencies": {
2929
"@actions/core": "^1.2.4",
3030
"@actions/github": "^4.0.0",
31-
"@octokit/plugin-rest-endpoint-methods": "^4.0.0",
31+
"@octokit/plugin-rest-endpoint-methods": "^4.1.0",
3232
"shell-escape": "^0.2.0",
3333
"sprintf-js": "^1.1.2"
3434
},
3535
"devDependencies": {
36-
"@commitlint/cli": "^9.0.1",
37-
"@commitlint/config-conventional": "^9.0.1",
38-
"@technote-space/github-action-test-helper": "^0.5.1",
36+
"@commitlint/cli": "^9.1.1",
37+
"@commitlint/config-conventional": "^9.1.1",
38+
"@technote-space/github-action-test-helper": "^0.5.3",
3939
"@types/jest": "^26.0.4",
40-
"@types/node": "^14.0.20",
41-
"@typescript-eslint/eslint-plugin": "^3.6.0",
42-
"@typescript-eslint/parser": "^3.6.0",
40+
"@types/node": "^14.0.23",
41+
"@typescript-eslint/eslint-plugin": "^3.6.1",
42+
"@typescript-eslint/parser": "^3.6.1",
4343
"eslint": "^7.4.0",
4444
"husky": "^4.2.5",
4545
"jest": "^26.1.0",
4646
"jest-circus": "^26.1.0",
4747
"lint-staged": "^10.2.11",
4848
"nock": "^13.0.2",
49-
"ts-jest": "^26.1.1",
49+
"ts-jest": "^26.1.2",
5050
"typescript": "^3.9.6"
5151
},
5252
"publishConfig": {

src/context-helper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export const isCron = (context: Context): boolean => 'schedule' === context.even
1515

1616
export const isCustomEvent = (context: Context): boolean => 'repository_dispatch' === context.eventName;
1717

18+
export const isManualEvent = (context: Context): boolean => 'workflow_dispatch' === context.eventName;
19+
1820
export const isCreateTag = (context: Context): boolean => 'create' === context.eventName && 'tag' === context.payload.ref_type;
1921

2022
export const getTagName = (context: Context): string => isRelease(context) ? context.payload.release.tag_name : (/^refs\/tags\//.test(context.ref) ? context.ref.replace(/^refs\/tags\//, '') : '');

0 commit comments

Comments
 (0)