Skip to content

Commit

Permalink
feat: Handle unlabeled events
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jun 27, 2024
1 parent 52298c6 commit c90acc6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 10 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ try {
// Temp environments enabled
if (github.context.eventName === "pull_request") {
const prEvent = github.context.payload;
const targetLabel = value.label;
if (!targetLabel) continue;
const hasLabel =
(prEvent.action === "labeled" &&
prEvent.label.name === targetLabel) ||
prEvent.pull_request.labels.some(
(label) => label.name === targetLabel,
let matches = false;
if (value.label) {
matches = prEvent.pull_request.labels.some(
(label) => label.name === value.label,
);
if (hasLabel) {
} else if (value.removed_label) {
matches = !prEvent.pull_request.labels.some(
(label) => label.name === value.removed_label,
);
}
if (matches) {
patterns = ref;
value.name = `${value.name || toTitleCase(env)} #${prEvent.number}`;
env += prEvent.number;
Expand Down

0 comments on commit c90acc6

Please sign in to comment.