Skip to content

Commit

Permalink
Support pull_request_target
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
Ana06 committed May 26, 2021
1 parent b17fbb0 commit 1beff32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Get All Changed Files

Get all of the files changed/modified in a pull request or push's commits.
Get all of the files changed/modified in a pull request (`pull_request` or `pull_request_target`) or push's commits.
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.
These outputs are available via the `steps` output context.
The `steps` output context exposes the output names `all`, `added`, `modified`, `removed`, `renamed`, and `added_modified`.
Expand Down
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3529,6 +3529,7 @@ function run() {
let base;
let head;
switch (eventName) {
case 'pull_request_target':
case 'pull_request':
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;
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;
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async function run(): Promise<void> {
let head: string | undefined

switch (eventName) {
case 'pull_request_target':
case 'pull_request':
base = context.payload.pull_request?.base?.sha
head = context.payload.pull_request?.head?.sha
Expand Down

0 comments on commit 1beff32

Please sign in to comment.