aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/label-intends-to-pr.yml
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-01 02:13:30 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-01 02:14:52 +0300
commit472e2b8453160affd05760b22a483b3c9ee100be (patch)
tree3d72f0778c3a3e9f2bc0091d9f07fa4e526c0858 /.github/workflows/label-intends-to-pr.yml
parent8307f2f712293970d80f624594d51e693d711cfb (diff)
chore: route feature intake to discussions
Diffstat (limited to '.github/workflows/label-intends-to-pr.yml')
-rw-r--r--.github/workflows/label-intends-to-pr.yml92
1 files changed, 0 insertions, 92 deletions
diff --git a/.github/workflows/label-intends-to-pr.yml b/.github/workflows/label-intends-to-pr.yml
deleted file mode 100644
index d25985b7..00000000
--- a/.github/workflows/label-intends-to-pr.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-name: Label contributor intent
-
-on:
- issues:
- types: [opened, edited]
-
-permissions:
- issues: write
-
-env:
- INTENDS_TO_PR_LABEL: intends-to-pr
-
-jobs:
- label:
- if: ${{ !github.event.issue.pull_request }}
- runs-on: ubuntu-latest
-
- steps:
- - name: Sync intends-to-pr label
- uses: actions/github-script@v9
- with:
- script: |
- const label = process.env.INTENDS_TO_PR_LABEL;
- const body = context.payload.issue.body || '';
- const issueNumber = context.payload.issue.number;
- const { owner, repo } = context.repo;
- const checkedIntentPattern = /^\s*-\s*\[[xX]\]\s*I intend to open a PR for this (?:change|issue)\.\s*$/m;
- const uncheckedIntentPattern = /^\s*-\s*\[ \]\s*I intend to open a PR for this (?:change|issue)\.\s*$/m;
- const cliIntentPattern = /^\s*\/i-intend-to-pr\s*$/m;
- const shouldAddLabel = checkedIntentPattern.test(body) || cliIntentPattern.test(body);
- const shouldRemoveLabel = uncheckedIntentPattern.test(body);
- const labels = context.payload.issue.labels.map((item) =>
- typeof item === 'string' ? item : item.name,
- );
- const hasLabel = labels.includes(label);
-
- if (shouldAddLabel && hasLabel) {
- console.log(`${label} is already present on #${issueNumber}.`);
- return;
- }
-
- if (shouldRemoveLabel && !hasLabel) {
- console.log(`${label} is already absent from #${issueNumber}.`);
- return;
- }
-
- if (!shouldAddLabel && !shouldRemoveLabel) {
- console.log(`No contribution intent signal found for #${issueNumber}.`);
- return;
- }
-
- if (shouldAddLabel) {
- try {
- await github.rest.issues.getLabel({ owner, repo, name: label });
- } catch (error) {
- if (error.status !== 404) {
- throw error;
- }
-
- await github.rest.issues.createLabel({
- owner,
- repo,
- name: label,
- color: '0E8A16',
- description: 'Contributor intends to open a PR for this issue.',
- });
- }
-
- await github.rest.issues.addLabels({
- owner,
- repo,
- issue_number: issueNumber,
- labels: [label],
- });
- console.log(`Added ${label} to #${issueNumber}.`);
- return;
- }
-
- try {
- await github.rest.issues.removeLabel({
- owner,
- repo,
- issue_number: issueNumber,
- name: label,
- });
- console.log(`Removed ${label} from #${issueNumber}.`);
- } catch (error) {
- if (error.status !== 404) {
- throw error;
- }
- console.log(`${label} was already absent from #${issueNumber}.`);
- }