Skip to content

Commit

Permalink
Merge branch 'main' into b122556
Browse files Browse the repository at this point in the history
  • Loading branch information
an920107 committed Feb 29, 2024
2 parents d1bef85 + d418b85 commit 5eb6ad1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Automatic PR Labeler
on:
pull_request:
types: [opened, reopened, edited]

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Label PR
uses: actions/github-script@v5
with:
script: |
const { owner, repo, number: issue_number } = context.issue;
const pr = await github.rest.pulls.get({ owner, repo, pull_number: issue_number });
const title = pr.data.title;
const labRegex = /\[LAB(\d+)\]/i;
const match = title.match(labRegex);
if (match) {
const labelToAdd = 'lab' + match[1];
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: [labelToAdd] });
}

0 comments on commit 5eb6ad1

Please sign in to comment.