mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-09-01 21:32:35 +02:00
Add labels to topic change suggestion issue
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
name: "✍️ Suggest Changes"
|
||||
name: "✍️ Missing or Deprecated Roadmap Topics"
|
||||
description: Help us improve the roadmaps by suggesting changes
|
||||
labels: [suggestion]
|
||||
labels: [topic-change]
|
||||
assignees: []
|
||||
body:
|
||||
- type: markdown
|
||||
|
29
.github/workflows/close-empty-issue.yml
vendored
29
.github/workflows/close-empty-issue.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: Close Issue if Empty
|
||||
on:
|
||||
issues:
|
||||
types: [ opened, edited ]
|
||||
jobs:
|
||||
close-empty-issue:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Close Issue if Empty
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const issue = context.payload.issue;
|
||||
if (issue.body.trim() === '') {
|
||||
await github.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: 'Closing this issue because it is empty. Feel free to reopen with more details if you have any questions or need help.',
|
||||
});
|
||||
|
||||
await github.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
});
|
||||
}
|
38
.github/workflows/label-issue.yml
vendored
Normal file
38
.github/workflows/label-issue.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
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'
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user