diff --git a/.github/ISSUE_TEMPLATE/01-add-an-alternative.md b/.github/ISSUE_TEMPLATE/01-add-an-alternative.md index 19d79da..ff42d3e 100644 --- a/.github/ISSUE_TEMPLATE/01-add-an-alternative.md +++ b/.github/ISSUE_TEMPLATE/01-add-an-alternative.md @@ -2,7 +2,7 @@ name: Add an alternative to the list about: Suggest the inclusion of a new mod that can replace an Essential function. title: "Add [mod] to the alternatives page." -labels: enhancement +labels: add mod assignees: - KTrain5169 - blryface diff --git a/.github/PULL_REQUEST_TEMPLATE/01-add-an-alternative.md b/.github/PULL_REQUEST_TEMPLATE/01-add-an-alternative.md index 3fc406d..9aa8e6e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/01-add-an-alternative.md +++ b/.github/PULL_REQUEST_TEMPLATE/01-add-an-alternative.md @@ -1,12 +1,6 @@ ---- -name: Adding new alternative -about: Select this if you are adding a new mod to the alternatives page. -title: "add: [mod name] to alternatives page" -labels: enhancement -assignees: - - KTrain5169 - - blryface ---- +# Alternative addition template + + ## What part(s) of Essential does this mod replace? diff --git a/.github/PULL_REQUEST_TEMPLATE/02-site-changes.md b/.github/PULL_REQUEST_TEMPLATE/02-site-changes.md index 8912639..4e507ce 100644 --- a/.github/PULL_REQUEST_TEMPLATE/02-site-changes.md +++ b/.github/PULL_REQUEST_TEMPLATE/02-site-changes.md @@ -1,12 +1,6 @@ ---- -name: Site changes -about: Select this if you changed the website in a different way. -title: "change/fix (choose one): [short description of the change]" -labels: enhancement -assignees: - - blryface - - WorldWidePixel ---- +# Site changes template + + ## Are there major changes (ex: signficantly revamping the website visuals) that we NEED to know about? diff --git a/.github/PULL_REQUEST_TEMPLATE/03-chore-stuff.md b/.github/PULL_REQUEST_TEMPLATE/03-chore-stuff.md index a62a2af..43c9dee 100644 --- a/.github/PULL_REQUEST_TEMPLATE/03-chore-stuff.md +++ b/.github/PULL_REQUEST_TEMPLATE/03-chore-stuff.md @@ -1,10 +1,6 @@ ---- -name: Other stuff that won't affect what people see -about: Select this if you are modifying something that won't affect what other people see on the site. -title: "chore: [short description of changes go here]" -labels: documentation -assignees: KTrain5169 ---- +# Chore/documentation template + + ## What have you changed? diff --git a/.github/pull_request_template.yml b/.github/pull_request_template.yml new file mode 100644 index 0000000..5e14ed2 --- /dev/null +++ b/.github/pull_request_template.yml @@ -0,0 +1,4 @@ +pull_request_templates: + - .github/PULL_REQUEST_TEMPLATE/01-add-an-alternative.md + - .github/PULL_REQUEST_TEMPLATE/02-site-changes.md + - .github/PULL_REQUEST_TEMPLATE/03-chore-stuff.md diff --git a/.github/workflows/first_contrib.yml b/.github/workflows/first_contrib.yml new file mode 100644 index 0000000..5c81eb0 --- /dev/null +++ b/.github/workflows/first_contrib.yml @@ -0,0 +1,13 @@ +name: Greetings + +on: [pull_request, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Hello! We've detected that this is your first issue here! If so, thank you! Please make sure everything in your template is correct!" + pr-message: "Hello! We've detected that this is your first PR here! If so, thank you! Please make sure everything in your template is correct and that you've reviewed our contributing guidelines, found here: https://notessential.blurryface.xyz/contributing" diff --git a/.github/workflows/pr_management.yml b/.github/workflows/pr_management.yml new file mode 100644 index 0000000..f20a60e --- /dev/null +++ b/.github/workflows/pr_management.yml @@ -0,0 +1,81 @@ +name: Auto Label PRs, then add assignees and reviewers automatically. + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + add_labels_reviewers_assignees: + name: Add labels, then reviewers & assignees + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Label PR based on content + id: label-pr + uses: actions/github-script@v7 + with: + script: | + const labels = { + 'alternative addition template': 'add mod', + 'site changes template': 'enhancement', + 'chore/documentation template': 'documentation' + }; + + const body = context.payload.pull_request.body.toLowerCase(); + + const foundLabels = Object.entries(labels) + .filter(([keyword]) => body.includes(keyword)) + .map(([, label]) => label); + + if (foundLabels.length > 0) { + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: foundLabels + }); + } + + return { labels: foundLabels }; + + - name: Set Reviewers and Assignees + if: steps.label-pr.outputs.labels != '[]' + uses: actions/github-script@v7 + with: + script: | + const labelToReviewers = { + 'add mod': ['KTrain5169', 'blryface'], + 'enhancement': ['WorldWidePixel', 'Nitrrine'], + 'documentation': ['blryface', 'KTrain5169', 'WorldWidePixel'] + }; + + const labels = JSON.parse('${{ steps.label-pr.outputs.labels }}').labels; + const reviewers = new Set(); + + labels.forEach(label => { + (labelToReviewers[label] || []).forEach(reviewer => reviewers.add(reviewer)); + }); + + if (reviewers.size > 0) { + await github.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + reviewers: Array.from(reviewers) + }); + } + + await github.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + assignees: [context.payload.pull_request.user.login] + }); + + - name: Comment on PRs + uses: dannyskoog/pull-request-comment@v1 + with: + message: I've labeled your PR, assigned you and requested reviews from the relevant people automatically. If you think I did it wrong, please comment below so one of our maintainers can double-check. Thanks!