File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -60,15 +60,15 @@ jobs:
60
60
throw new Error(`Error: @${username} is not a repository collaborator.`);
61
61
}
62
62
63
- const regex = /\/deploy ([a-zA-Z\d\-\_]+)/;
64
- const arguments = regex.exec(context.payload.comment.body);
63
+ const comment = context.payload.comment.body;
64
+ const regex = /^\/deploy(\s+([a-zA-Z\d\-\_]+))?\s*$/;
65
+ const arguments = regex.exec(comment);
65
66
66
- if (arguments === null || arguments.length < 2 ) {
67
- throw new Error(' Invalid command' );
67
+ if (! arguments || arguments.length < 1 ) {
68
+ throw new Error(` Invalid command: ${comment}` );
68
69
}
69
70
70
- const environment = arguments[1].trim();
71
- return environment;
71
+ return arguments[2] || 'dev';
72
72
73
73
- name : ' Find run for #${{ github.event.issue.number }}'
74
74
uses : actions/github-script@v7
You can’t perform that action at this time.
0 commit comments