Skip to content

Commit

Permalink
Allow setting breaking_against
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Jun 28, 2024
1 parent 0ef1fa1 commit eff0b5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53866,7 +53866,7 @@ function getInputs() {
lint: core.getBooleanInput("lint"),
format: core.getBooleanInput("format"),
breaking: core.getBooleanInput("breaking"),
breaking_against: "",
breaking_against: core.getInput("breaking_against"),
push: core.getBooleanInput("push"),
push_disable_create: core.getBooleanInput("push_disable_create"),
archive: core.getBooleanInput("archive"),
Expand All @@ -53875,14 +53875,18 @@ function getInputs() {
if (lib_github.context.eventName === "push") {
const event = lib_github.context.payload;
core.info(`The head commit is: ${event.before}`);
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.before}`;
if (inputs.breaking_against === "") {
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.before}`;
}
console.log("BREAKING AGAINST", inputs.breaking_against);
inputs.archive_labels.push(lib_github.context.ref);
}
if (lib_github.context.eventName === "pull_request") {
const event = lib_github.context.payload;
core.info(`The head commit is: ${event.pull_request.head.sha}`);
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.pull_request.base.sha}`;
if (inputs.breaking_against === "") {
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.pull_request.base.sha}`;
}
console.log("BREAKING AGAINST", inputs.breaking_against);
inputs.archive_labels.push(lib_github.context.ref);
}
Expand Down
10 changes: 7 additions & 3 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function getInputs(): Inputs {
lint: core.getBooleanInput("lint"),
format: core.getBooleanInput("format"),
breaking: core.getBooleanInput("breaking"),
breaking_against: "",
breaking_against: core.getInput("breaking_against"),
push: core.getBooleanInput("push"),
push_disable_create: core.getBooleanInput("push_disable_create"),
archive: core.getBooleanInput("archive"),
Expand All @@ -72,14 +72,18 @@ export function getInputs(): Inputs {
if (github.context.eventName === "push") {
const event = github.context.payload as PushEvent;
core.info(`The head commit is: ${event.before}`);
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.before}`;
if (inputs.breaking_against === "") {
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.before}`;
}
console.log("BREAKING AGAINST", inputs.breaking_against);
inputs.archive_labels.push(github.context.ref);
}
if (github.context.eventName === "pull_request") {
const event = github.context.payload as PullRequestEvent;
core.info(`The head commit is: ${event.pull_request.head.sha}`);
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.pull_request.base.sha}`;
if (inputs.breaking_against === "") {
inputs.breaking_against = `${event.repository.clone_url}#format=git,commit=${event.pull_request.base.sha}`;
}
console.log("BREAKING AGAINST", inputs.breaking_against);
inputs.archive_labels.push(github.context.ref);
}
Expand Down

0 comments on commit eff0b5e

Please sign in to comment.