You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
related: #327
This new GitHub Actions workflow listens for the 'opened' and 'labeled' events on GitHub issues and ensures any issue opened (or labelled) with a `planning` label meets the following criteria:
- only users listed in the `AUTHORIZED_USER` JSON array can label an issue with the `planning` label
- the `planning` label must be accompanied by exactly one of the following labels:
- `epic`, `feature`, `task`, `bug`
If an issue (with a `planning` label) is **opened** by a non-authorized user - the issue will be automatically closed when the GitHub action fires.
If an issue is labelled with the `planning` label by an unauthorized user - the `planning` label is removed.
In both cases, a GitHub comment is added to the issue explaining why the issue was updated by the bot.
Please note, when opening a GH issue - **BOTH** the `opened` and `labeled` events will fire (if the issue has a label on it). As such, the GitHub action in this PR was deliberately structured to account for multiple instances running in parallel on the same underlying GitHub issue.
Also, this work complements #361 - which defines GH issue templates that use the labels in a manner appropriate to satisfy the checks of this action.
Signed-off-by: Andy Stoneberg <[email protected]>
// Add a comment explaining why the label was removed
84
+
await github.rest.issues.createComment({
85
+
owner: context.repo.owner,
86
+
repo: context.repo.repo,
87
+
issue_number: issueNumber,
88
+
body: `@${actor} The planning label requires exactly one of the following labels to be present: ${planningLabels.join(', ')}. Please add one of these labels before adding the planning label.`
89
+
});
90
+
91
+
core.setFailed(`Planning label requires exactly one of: ${planningLabels.join(', ')}`);
92
+
}
93
+
94
+
console.log(`Issue has valid planning label combination: planning + ${presentPlanningLabels[0]}`);
0 commit comments