Skip to content

Commit

Permalink
chore(actions): add icon leads notification for calcite-ui-icons requ…
Browse files Browse the repository at this point in the history
…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
geospatialem authored and benelan committed Feb 8, 2025
1 parent fccfa39 commit 11a694f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/scripts/notifyAboutIconRequest.js
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}`,
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name : "Assign for verification"
- name: "Assign for verification"
if: github.event.label.name == '3 - installed'
uses: actions/github-script@v7
env:
Expand Down Expand Up @@ -51,3 +51,12 @@ jobs:
const action = require('${{ github.workspace }}/.github/scripts/notifyAboutNewComponent.js')
await action({github, context, core})
- name: "Icon request notification"
if: github.event.label.name == 'calcite-ui-icons'
uses: actions/github-script@v7
env:
ICONS_TEAM: ${{secrets.ICON_LEADS}}
with:
script: |
const action = require('${{ github.workspace }}/.github/scripts/notifyAboutIconRequest.js')
await action({github, context, core})

0 comments on commit 11a694f

Please sign in to comment.