-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(actions): add icon leads notification for calcite-ui-icons requ…
…ests (#11263) **Related Issue:** #9922 ## Summary Add automation to issues when the `calcite-ui-icons` label is added, where Icon team leads will receive an `@` notification via a comment, similar to the [new component label automation](#10382 (comment)) from the [notifyAboutNewComponent script](https://github.com/Esri/calcite-design-system/blob/dev/.github/scripts/notifyAboutNewComponent.js). cc @allieorth, @arowles
- Loading branch information
1 parent
fccfa39
commit 11a694f
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// @ts-check | ||
|
||
// If the "calcite-ui-icons" label is added to an issue, generates a notification to the Icons team leads to review | ||
// The secret is formatted like so: icon-team-member-1, icon-team-member-2, icon-team-member-3 | ||
// Note the script automatically adds the "@" character in to notify the icon team lead(s) | ||
|
||
/** @param {import('github-script').AsyncFunctionArguments} AsyncFunctionArguments */ | ||
module.exports = async ({ github, context }) => { | ||
const { repo, owner } = context.repo; | ||
|
||
const payload = /** @type {import('@octokit/webhooks-types').IssuesLabeledEvent} */ (context.payload); | ||
const { | ||
issue: { number }, | ||
} = payload; | ||
|
||
const { ICONS_TEAM } = process.env; | ||
|
||
// Add a "@" character to notify the user | ||
const icon_leads = ICONS_TEAM?.split(",").map((v) => " @" + v.trim()); | ||
|
||
if (!icon_leads?.length) { | ||
console.error("unable to determine icon leads"); | ||
process.exit(1); | ||
} | ||
|
||
// Add a comment to issues with the 'calcite-ui-icons' label to notify icon team lead(s) | ||
await github.rest.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: number, | ||
body: `cc ${icon_leads}`, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters