Skip to content

Commit f834fde

Browse files
authored
Merge pull request #97 from AgnesToulet/main
Repository Dispatch: improve error message for fork PRs
2 parents d56f9f8 + 6650d6c commit f834fde

File tree

6 files changed

+165
-93
lines changed

6 files changed

+165
-93
lines changed

common/globmatcher.js

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

common/utils.js

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"@types/jest": "^27.4.0",
4343
"@types/node": "^14.14.7",
4444
"@types/yargs": "^15.0.4",
45-
"@typescript-eslint/eslint-plugin": "^5.6.0",
46-
"@typescript-eslint/parser": "^5.6.0",
45+
"@typescript-eslint/eslint-plugin": "^5.27.0",
46+
"@typescript-eslint/parser": "^5.27.0",
4747
"chai": "^4.2.0",
4848
"eslint": "^8.4.1",
4949
"eslint-config-prettier": "^8.3.0",
@@ -54,7 +54,7 @@
5454
"prettier": "2.5.1",
5555
"ts-jest": "^27.1.3",
5656
"ts-node": "^8.10.2",
57-
"typescript": "^4.5.2",
57+
"typescript": "^4.7.2",
5858
"yargs": "^15.3.1"
5959
},
6060
"husky": {

repository-dispatch/index.js

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

repository-dispatch/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ import { getInput } from '@actions/core'
66
class RepositoryDispatch extends Action {
77
id = 'RepositoryDispatch'
88

9+
constructor() {
10+
const token = getInput('token')
11+
const eventType = getInput('event_type')
12+
if (!token && eventType === 'oss-pull-request') {
13+
console.log(
14+
"Token is empty, can't dispatch event. This is expected for PRs coming from forks, please check that the changes are compatible with Enterprise before merging this PR.",
15+
)
16+
}
17+
18+
super()
19+
}
20+
921
async runAction(): Promise<void> {
1022
const repository = getInput('repository')
1123
if (!repository) {

0 commit comments

Comments
 (0)