computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.3 KiB
38 lines
1.3 KiB
name: Label Issue |
|
on: |
|
issues: |
|
types: [ opened, edited ] |
|
jobs: |
|
label-topic-change-issue: |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Add roadmap slug to issue as label |
|
uses: actions/github-script@v3 |
|
with: |
|
github-token: ${{ secrets.GITHUB_TOKEN }} |
|
script: | |
|
const issue = context.payload.issue; |
|
const roadmapUrl = issue.body.match(/https?:\/\/roadmap.sh\/[^ ]+/); |
|
|
|
// if the issue is labeled as a topic-change, add the roadmap slug as a label |
|
if (issue.labels.some(label => label.name === 'topic-change')) { |
|
if (roadmapUrl) { |
|
const roadmapSlug = new URL(roadmapUrl[0]).pathname.replace(/\//, ''); |
|
github.issues.addLabels({ |
|
owner: context.repo.owner, |
|
repo: context.repo.repo, |
|
issue_number: issue.number, |
|
labels: [roadmapSlug] |
|
}); |
|
} |
|
|
|
// Close the issue if it has no roadmap URL |
|
if (!roadmapUrl) { |
|
github.issues.update({ |
|
owner: context.repo.owner, |
|
repo: context.repo.repo, |
|
issue_number: issue.number, |
|
state: 'closed' |
|
}); |
|
} |
|
} |