diff --git a/.github/ISSUE_TEMPLATE/01-suggest-changes.yml b/.github/ISSUE_TEMPLATE/01-suggest-changes.yml index cf39acc72..48c3a0341 100644 --- a/.github/ISSUE_TEMPLATE/01-suggest-changes.yml +++ b/.github/ISSUE_TEMPLATE/01-suggest-changes.yml @@ -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 diff --git a/.github/workflows/close-empty-issue.yml b/.github/workflows/close-empty-issue.yml deleted file mode 100644 index 7637004e3..000000000 --- a/.github/workflows/close-empty-issue.yml +++ /dev/null @@ -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', - }); - } \ No newline at end of file diff --git a/.github/workflows/label-issue.yml b/.github/workflows/label-issue.yml new file mode 100644 index 000000000..010e2da09 --- /dev/null +++ b/.github/workflows/label-issue.yml @@ -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' + }); + } + } \ No newline at end of file diff --git a/scripts/delete-issues.sh b/scripts/delete-issues.sh new file mode 100755 index 000000000..8e4e98225 --- /dev/null +++ b/scripts/delete-issues.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Fetch issues JSON data and parse it properly +issues=$(gh issue list --repo kamranahmedse/developer-roadmap --search "sort:created-asc" --state open --limit 500 --json number,title,createdAt,updatedAt,state,url,comments,reactionGroups,body | jq -c '.[]') + +# Loop through the issues and delete the ones created in 2022 and not updated in the past year +while IFS= read -r issue; do + created_at=$(echo "$issue" | jq -r '.createdAt') + updated_at=$(echo "$issue" | jq -r '.updatedAt') + issue_number=$(echo "$issue" | jq -r '.number') + issue_title=$(echo "$issue" | jq -r '.title') + reaction_groups=$(echo "$issue" | jq -r '.reactionGroups') + has_reactions=$(echo "$issue" | jq -r '.reactionGroups | length') + comment_count=$(echo "$issue" | jq -r '.comments | length') + body_characters=$(echo "$issue" | jq -r '.body | length') + + # if has empty body + if [[ "$created_at" == 2024-01* ]]; then + + comment="Hey there! + +Looks like this issue has been hanging around for a bit without much action. Our roadmaps have evolved quite a bit since then, and a bunch of older issues aren't really applicable anymore. So, we're tidying things up by closing out the older ones to keep our issue tracker nice and organized for future feedback. + +If you still think this problem needs addressing, don't hesitate to reopen the issue. We're here to help! + +Thanks a bunch!" + + gh issue comment "$issue_number" --body "$comment" + gh issue close "$issue_number" + fi +done <<< "$issues"