Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running the job on pull_request_target #16

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 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 Expand Up @@ -3565,11 +3566,6 @@ function run() {
core.setFailed(`The GitHub API for comparing the base and head commits for this ${github_1.context.eventName} event returned ${response.status}, expected 200. ` +
"Please submit an issue on this action's GitHub repo.");
}
// Ensure that the head commit is ahead of the base commit.
if (response.data.status !== 'ahead') {
core.setFailed(`The head commit for this ${github_1.context.eventName} event is not ahead of the base commit. ` +
"Please submit an issue on this action's GitHub repo.");
}
// Get the changed files from the response payload.
const files = response.data.files;
const all = [], added = [], modified = [], removed = [], renamed = [], addedModified = [];
Expand Down
9 changes: 1 addition & 8 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 Expand Up @@ -74,14 +75,6 @@ async function run(): Promise<void> {
)
}

// Ensure that the head commit is ahead of the base commit.
if (response.data.status !== 'ahead') {
core.setFailed(
`The head commit for this ${context.eventName} event is not ahead of the base commit. ` +
"Please submit an issue on this action's GitHub repo."
)
}

// Get the changed files from the response payload.
const files = response.data.files
const all = [] as string[],
Expand Down