Skip to content

Commit 1beff32

Browse files
committed
Support pull_request_target
`pull_request_target` is granted a read/write repository token and runs in the context of the base of the pull request. It allows to create workflows that label and comment on pull requests based on the contents of the event payload. The `get-changed-files` action is useful for some of those actions and the code works for this case with almost no modification.
1 parent b17fbb0 commit 1beff32

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Get All Changed Files
66

7-
Get all of the files changed/modified in a pull request or push's commits.
7+
Get all of the files changed/modified in a pull request (`pull_request` or `pull_request_target`) or push's commits.
88
You can choose to get all changed files, only added files, only modified files, only removed files, only renamed files, or all added and modified files.
99
These outputs are available via the `steps` output context.
1010
The `steps` output context exposes the output names `all`, `added`, `modified`, `removed`, `renamed`, and `added_modified`.

dist/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,6 +3529,7 @@ function run() {
35293529
let base;
35303530
let head;
35313531
switch (eventName) {
3532+
case 'pull_request_target':
35323533
case 'pull_request':
35333534
base = (_b = (_a = github_1.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.base) === null || _b === void 0 ? void 0 : _b.sha;
35343535
head = (_d = (_c = github_1.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.head) === null || _d === void 0 ? void 0 : _d.sha;

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ async function run(): Promise<void> {
2626
let head: string | undefined
2727

2828
switch (eventName) {
29+
case 'pull_request_target':
2930
case 'pull_request':
3031
base = context.payload.pull_request?.base?.sha
3132
head = context.payload.pull_request?.head?.sha

0 commit comments

Comments
 (0)