diff --git a/.github/scripts/constants.js b/.github/scripts/constants.js index ce4ed8ddeef..8bfe5571974 100644 --- a/.github/scripts/constants.js +++ b/.github/scripts/constants.js @@ -18,6 +18,9 @@ module.exports = Object.freeze({ /** @type {string} */ "PR_IS_MERGED": process.env.PR_IS_MERGED || "false", + /** @type {string} */ + "PR_LABELS": process.env.PR_LABELS || "", + /** @type {string} */ "LABEL_BLOCK": "do-not-merge", diff --git a/.github/scripts/label_pr_based_on_title.js b/.github/scripts/label_pr_based_on_title.js index e2e208c2d78..02f77f448b8 100644 --- a/.github/scripts/label_pr_based_on_title.js +++ b/.github/scripts/label_pr_based_on_title.js @@ -1,4 +1,4 @@ -const { PR_NUMBER, PR_TITLE } = require("./constants") +const { PR_NUMBER, PR_TITLE, PR_LABELS } = require("./constants") module.exports = async ({github, context, core}) => { const FEAT_REGEX = /feat(\((.+)\))?(:.+)/ @@ -18,10 +18,9 @@ module.exports = async ({github, context, core}) => { } // get PR labels from env - const prLabels = process.env.PR_LABELS.replaceAll("\"", "").split(","); + const prLabels = PR_LABELS.replaceAll("\"", "").split(","); const labelKeys = Object.keys(labels); - // Maintenance: We should keep track of modified PRs in case their titles change let miss = 0; try { for (const label in labels) { diff --git a/.github/workflows/label_pr_on_title.yml b/.github/workflows/label_pr_on_title.yml index a56588da95d..2a03f56e4c4 100644 --- a/.github/workflows/label_pr_on_title.yml +++ b/.github/workflows/label_pr_on_title.yml @@ -56,6 +56,7 @@ jobs: env: PR_NUMBER: ${{ needs.get_pr_details.outputs.prNumber }} PR_TITLE: ${{ needs.get_pr_details.outputs.prTitle }} + PR_LABELS: ${{ needs.get_pr_details.outputs.prLabels }} with: github-token: ${{ secrets.GITHUB_TOKEN }} # This safely runs in our base repo, not on fork