Merge pull request #3678 from SillyTavern/update-git-workflows Update github workflows for better issue & PR management, automating chores
Signed| @@ -1,4 +1,5 @@ | |||
| 1 | name: Bug Report π | 1 | name: Bug Report π |
| 2 | type: Bug | ||
| 2 | description: Report something that's not working the intended way. Support requests for external programs (reverse proxies, 3rd party servers, other peoples' forks) will be refused! Please use English only. | 3 | description: Report something that's not working the intended way. Support requests for external programs (reverse proxies, 3rd party servers, other peoples' forks) will be refused! Please use English only. |
| 3 | title: '[BUG] <title>' | 4 | title: '[BUG] <title>' |
| 4 | labels: ['π Bug'] | 5 | labels: ['π Bug'] |
| @@ -1,4 +1,5 @@ | |||
| 1 | name: Feature Request β¨ | 1 | name: Feature Request β¨ |
| 2 | type: Feature | ||
| 2 | description: Suggest an idea for future development of this project. Please use English only. | 3 | description: Suggest an idea for future development of this project. Please use English only. |
| 3 | title: '[FEATURE_REQUEST] <title>' | 4 | title: '[FEATURE_REQUEST] <title>' |
| 4 | labels: ['π¦ Feature Request'] | 5 | labels: ['π¦ Feature Request'] |
| @@ -1,2 +0,0 @@ | |||
| 1 | π Bug: β Fixed | ||
| 2 | π¦ Feature Request: β Implemented | ||
| 2 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1,62 +0,0 @@ | |||
| 1 | comment: | ||
| 2 | footer: | | ||
| 3 | --- | ||
| 4 | > I am a bot, and this is an automated message π€ | ||
| 5 | labels: | ||
| 6 | - name: βοΈ Invalid | ||
| 7 | labeled: | ||
| 8 | issue: | ||
| 9 | action: close | ||
| 10 | body: > | ||
| 11 | Hello @{{ issue.user.login }} your ticket has been marked as invalid. | ||
| 12 | Please ensure you follow the issue template, provide all requested info, | ||
| 13 | and be sure to check the docs + previous issues prior to raising tickets. | ||
| 14 | pr: | ||
| 15 | body: Thank you @{{ pull_request.user.login }} for suggesting this. Please follow the pull request templates. | ||
| 16 | action: close | ||
| 17 | |||
| 18 | - name: π©βπ» Good First Issue | ||
| 19 | labeled: | ||
| 20 | issue: | ||
| 21 | body: > | ||
| 22 | This issue has been marked as a good first issue for first-time contributors to implement! | ||
| 23 | This is a great way to support the project, while also improving your skills, you'll also be credited as a contributor once your PR is merged. | ||
| 24 | If you're new to SillyTavern [here are a collection of resources](https://docs.sillytavern.app/) | ||
| 25 | If you need any support at all, feel free to reach out via [Discord](https://discord.gg/sillytavern). | ||
| 26 | |||
| 27 | - name: β wontfix | ||
| 28 | labeled: | ||
| 29 | issue: | ||
| 30 | action: close | ||
| 31 | body: > | ||
| 32 | This ticked has been marked as 'wontfix', which usually means it is out-of-scope, or not feasible at this time. | ||
| 33 | You can still fork the project and make the changes yourself. | ||
| 34 | |||
| 35 | - name: β Fixed | ||
| 36 | labeled: | ||
| 37 | issue: | ||
| 38 | body: > | ||
| 39 | Hello @{{ issue.user.login }}! It looks like all or part of this issue has now been implemented. | ||
| 40 | |||
| 41 | |||
| 42 | - name: βΌοΈ High Priority | ||
| 43 | labeled: | ||
| 44 | issue: | ||
| 45 | body: > | ||
| 46 | This ticket has been marked as high priority, and has been bumped to the top of the priority list. | ||
| 47 | You should expect an implementation to be pushed out soon. Thank you for your patience. | ||
| 48 | |||
| 49 | - name: π Spam | ||
| 50 | labeled: | ||
| 51 | issue: | ||
| 52 | action: close | ||
| 53 | locking: lock | ||
| 54 | lock_reason: spam | ||
| 55 | body: > | ||
| 56 | This issue has been identified as spam, and is now locked. | ||
| 57 | Users who repeatedly raise spam issues may be blocked or reported. | ||
| 58 | |||
| 59 | - name: β Don't Merge | ||
| 60 | labeled: | ||
| 61 | pr: | ||
| 62 | body: This PR has been temporarily blocked from merging. | ||
| 62 | \ No newline at end of file | \ No newline at end of file | |
| @@ -0,0 +1,69 @@ | |||
| 1 | labels: | ||
| 2 | - name: βοΈ Invalid | ||
| 3 | labeled: | ||
| 4 | issue: | ||
| 5 | action: close | ||
| 6 | body: > | ||
| 7 | Hey @{{ issue.user.login }}, this issue has been marked as invalid. | ||
| 8 | |||
| 9 | Please double-check that you've followed the issue template, included all necessary details, and reviewed the docs & previous issues before submitting. | ||
| 10 | If provided, follow the instructions given by maintainers. | ||
| 11 | |||
| 12 | - name: π©βπ» Good First Issue | ||
| 13 | labeled: | ||
| 14 | issue: | ||
| 15 | body: > | ||
| 16 | π This issue has been marked as a good first issue for contributors to implement! | ||
| 17 | This is a great way to support the project. While also improving your skills, you'll also be credited as a contributor once your PR is merged. | ||
| 18 | |||
| 19 | If you're new to SillyTavern [here is the official documentation](https://docs.sillytavern.app/). The official contribution guide can be found [here](https://github.com/SillyTavern/SillyTavern/blob/release/CONTRIBUTING.md). | ||
| 20 | If you need any support, feel free to reach out via [Discord](https://discord.gg/sillytavern), or let us know in this issue or via [discussions](https://github.com/SillyTavern/SillyTavern/discussions). | ||
| 21 | |||
| 22 | - name: β wontfix | ||
| 23 | labeled: | ||
| 24 | issue: | ||
| 25 | action: close | ||
| 26 | body: > | ||
| 27 | β This issue has been marked as 'wontfix', which usually means it is out-of-scope, not feasible at this time or will not be implemented for various reasons. | ||
| 28 | If you have any questions about this, feel free to reach out. | ||
| 29 | |||
| 30 | - name: π Out of Scope | ||
| 31 | labeled: | ||
| 32 | issue: | ||
| 33 | action: close | ||
| 34 | body: > | ||
| 35 | π This issue has been marked as 'out of scope', as this can't or won't be implemented. | ||
| 36 | If you have any questions about this, feel free to reach out. | ||
| 37 | |||
| 38 | - name: β Done (staging) | ||
| 39 | labeled: | ||
| 40 | issue: | ||
| 41 | body: > | ||
| 42 | β It looks like all or part of this issue has now been implemented as part of the `staging` branch. | ||
| 43 | If you currently are on the `release` branch, you can switch to `staging` to test this right away. | ||
| 44 | |||
| 45 | Note that `staging` is considered less stable than the official releases. To switch, follow existing instructions, | ||
| 46 | or simply enter the following command: `git switch staging` | ||
| 47 | |||
| 48 | - name: β Done | ||
| 49 | labeled: | ||
| 50 | issue: | ||
| 51 | body: > | ||
| 52 | β It looks like all or part of this issue has now been implemented as part of the latest release. | ||
| 53 | |||
| 54 | - name: βΌοΈ High Priority | ||
| 55 | labeled: | ||
| 56 | issue: | ||
| 57 | body: > | ||
| 58 | π¨ This issue has been marked high priority, meaning it's important to the maintainers or community. | ||
| 59 | While we can't promise immediate changes, it is on our radar and will be addressed whenever possible. Thanks for your patience! | ||
| 60 | |||
| 61 | - name: π Spam | ||
| 62 | labeled: | ||
| 63 | issue: | ||
| 64 | action: close | ||
| 65 | locking: lock | ||
| 66 | lock_reason: spam | ||
| 67 | body: > | ||
| 68 | π This issue has been flagged as spam and is now locked. | ||
| 69 | Please avoid posting spam - it disrupts the community and wastes everyone's time. | ||
| @@ -1,7 +1,3 @@ | |||
| 1 | # Add/remove 'critical' label if issue contains the words 'urgent' or 'critical' | ||
| 2 | #critical: | ||
| 3 | # - '(critical|urgent)' | ||
| 4 | |||
| 5 | πͺ Windows: | 1 | πͺ Windows: |
| 6 | - '(πͺ Windows)' | 2 | - '(πͺ Windows)' |
| 7 | 3 | ||
| @@ -16,3 +12,9 @@ | |||
| 16 | 12 | ||
| 17 | π§ Linux: | 13 | π§ Linux: |
| 18 | - '(π§ Linux)' | 14 | - '(π§ Linux)' |
| 15 | |||
| 16 | π¦ Firefox: | ||
| 17 | - '(firefox|mozilla)' | ||
| 18 | |||
| 19 | π± Mobile: | ||
| 20 | - '(iphone|ios|android|π± Termux)' | ||
| @@ -0,0 +1,51 @@ | |||
| 1 | labels: | ||
| 2 | - name: βοΈ Invalid | ||
| 3 | labeled: | ||
| 4 | pr: | ||
| 5 | action: close | ||
| 6 | body: > | ||
| 7 | Hey @{{ pull_request.user.login }}, thanks for your contribution! | ||
| 8 | Unfortunately, this PR has been marked as invalid. | ||
| 9 | |||
| 10 | Please check that you've followed the PR template, included all relevant details, and are targeting the correct branch (`staging` for regular contributions, `release` only for hotfixes). | ||
| 11 | |||
| 12 | If you need help, feel free to ask! | ||
| 13 | |||
| 14 | - name: β Don't Merge | ||
| 15 | labeled: | ||
| 16 | pr: | ||
| 17 | body: > | ||
| 18 | π¨ This PR has been temporarily blocked from merging. | ||
| 19 | |||
| 20 | - name: π₯π£ Breaking Changes | ||
| 21 | labeled: | ||
| 22 | pr: | ||
| 23 | body: > | ||
| 24 | β οΈ Heads up! This PR introduces breaking changes. | ||
| 25 | |||
| 26 | Make sure these changes are well-documented and that users will be properly informed when this is released. | ||
| 27 | |||
| 28 | - name: β Waiting For External/Upstream | ||
| 29 | labeled: | ||
| 30 | pr: | ||
| 31 | body: > | ||
| 32 | β This PR is awaiting external or upstream changes or approval. | ||
| 33 | It can only be merged once those changes have been implemented and approved. | ||
| 34 | |||
| 35 | Please inform us of any progress on the upstream changes or approval. | ||
| 36 | |||
| 37 | - name: π¬ Needs Testing | ||
| 38 | labeled: | ||
| 39 | pr: | ||
| 40 | body: > | ||
| 41 | π¬ This PR needs testing! | ||
| 42 | Any contributor can test and leave reviews, so feel free to help us out! | ||
| 43 | |||
| 44 | - name: π₯ ⬀⬀⬀⬀⬀ | ||
| 45 | labeled: | ||
| 46 | pr: | ||
| 47 | body: > | ||
| 48 | β οΈ This PR is over 1000 lines, which is larger than recommended. | ||
| 49 | |||
| 50 | Please make sure that it only addresses a single issue - PRs this large are hard to test and may be rejected. | ||
| 51 | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | #################################### | ||
| 2 | # Label PRs against 'release' # | ||
| 3 | #################################### | ||
| 4 | β Against Release Branch: | ||
| 5 | - base-branch: 'release' | ||
| 6 | |||
| 7 | #################################### | ||
| 8 | # Labels based on PR branch name # | ||
| 9 | #################################### | ||
| 10 | π¦ Bug Fix: | ||
| 11 | - head-branch: ['^fix[/-]', '\bfixes\b'] | ||
| 12 | |||
| 13 | π Hot Fix: | ||
| 14 | - head-branch: ['^hotfix[/-]'] | ||
| 15 | |||
| 16 | β¨ New Feature: | ||
| 17 | - head-branch: ['^feat(ure)?[/-].*?\badd', '^add-'] | ||
| 18 | |||
| 19 | β¨ Feature Changes: | ||
| 20 | - head-branch: ['^feat(ure)?[/-](?!.*\badd\b)', '\bchanges?\b'] | ||
| 21 | |||
| 22 | π€ API / Model: | ||
| 23 | - head-branch: ['\bapi\b', '\bmodels?\b'] | ||
| 24 | |||
| 25 | π Backend Changes: | ||
| 26 | - head-branch: ['\bbackend\b', '\bendpoints?\b'] | ||
| 27 | |||
| 28 | π Docker: | ||
| 29 | - head-branch: ['\bdocker\b'] | ||
| 30 | |||
| 31 | β Extension: | ||
| 32 | - head-branch: ['\bextension\b', '\bext\b'] | ||
| 33 | |||
| 34 | π¦ Firefox: | ||
| 35 | - head-branch: ['\bfirefox\b'] | ||
| 36 | |||
| 37 | πΌοΈ Image Gen: | ||
| 38 | - head-branch: ['\bimage-gen\b'] | ||
| 39 | |||
| 40 | π Language: | ||
| 41 | - head-branch: ['\btranslations?\b', '\blanguages?\b'] | ||
| 42 | |||
| 43 | π§ Linux: | ||
| 44 | - head-branch: ['\blinux\b'] | ||
| 45 | |||
| 46 | π§© Macros: | ||
| 47 | - head-branch: ['\bmacros?\b'] | ||
| 48 | |||
| 49 | π± Mobile: | ||
| 50 | - head-branch: ['\bmobile\b', '\bios\b', '\bandroid\b'] | ||
| 51 | |||
| 52 | π Performance: | ||
| 53 | - head-branch: ['\bperformance\b'] | ||
| 54 | |||
| 55 | βοΈ Preset: | ||
| 56 | - head-branch: ['\bpresets?\b'] | ||
| 57 | |||
| 58 | π Prompt: | ||
| 59 | - head-branch: ['\bprompt\b'] | ||
| 60 | |||
| 61 | π Refactor: | ||
| 62 | - head-branch: ['\brefactor(s|ed)?\b'] | ||
| 63 | |||
| 64 | π STscript: | ||
| 65 | - head-branch: ['\bstscript\b', '\bslash-commands\b'] | ||
| 66 | |||
| 67 | π·οΈ Tags / Folders: | ||
| 68 | - head-branch: ['\btags\b'] | ||
| 69 | |||
| 70 | ποΈ TTS / Voice: | ||
| 71 | - head-branch: ['\btts\b', '\bvoice\b'] | ||
| 72 | |||
| 73 | π UX: | ||
| 74 | - head-branch: ['\bux\b'] | ||
| 75 | |||
| 76 | πΊοΈ World Info: | ||
| 77 | - head-branch: ['\bworld-info\b', '\bwi\b'] | ||
| @@ -0,0 +1,46 @@ | |||
| 1 | #################################### | ||
| 2 | # Labels based on changed files # | ||
| 3 | #################################### | ||
| 4 | π Backend Changes: | ||
| 5 | - changed-files: | ||
| 6 | - any-glob-to-any-file: | ||
| 7 | - "src/**" | ||
| 8 | - "default/config.yaml" | ||
| 9 | - "server.js" | ||
| 10 | - "plugins.js" | ||
| 11 | - "recover.js" | ||
| 12 | - "webpack.config.js" | ||
| 13 | - "Start.bat" | ||
| 14 | - "start.sh" | ||
| 15 | - "UpdateAndStart.bat" | ||
| 16 | - "UpdateForkAndStart.bat" | ||
| 17 | |||
| 18 | βοΈ config.yaml: | ||
| 19 | - changed-files: | ||
| 20 | - any-glob-to-any-file: | ||
| 21 | - "default/config.yaml" | ||
| 22 | |||
| 23 | π οΈ Build Changes: | ||
| 24 | - changed-files: | ||
| 25 | - any-glob-to-any-file: | ||
| 26 | - ".github/workflows/**" | ||
| 27 | - "docker/**" | ||
| 28 | - ".dockerignore" | ||
| 29 | - "Dockerfile" | ||
| 30 | - "webpack.config.js" | ||
| 31 | |||
| 32 | π Language: | ||
| 33 | - changed-files: | ||
| 34 | - any-glob-to-any-file: | ||
| 35 | - "public/locales/**" | ||
| 36 | |||
| 37 | π₯ Dependencies: | ||
| 38 | - changed-files: | ||
| 39 | - any-glob-to-any-file: | ||
| 40 | - "public/lib/**" # Every frontend lib counts as a dependency as well | ||
| 41 | - "package.json" | ||
| 42 | - "package-lock.json" | ||
| 43 | - "tests/package.json" | ||
| 44 | - "tests/package-lock.json" | ||
| 45 | - "src/electron/package.json" | ||
| 46 | - "src/electron/package-lock.json" | ||
| @@ -1,28 +0,0 @@ | |||
| 1 | # Based on a label applied to an issue, the bot will add a comment with some additional info | ||
| 2 | |||
| 3 | name: π― Auto-Reply to Labeled Tickets | ||
| 4 | on: | ||
| 5 | issues: | ||
| 6 | types: | ||
| 7 | - labeled | ||
| 8 | - unlabeled | ||
| 9 | pull_request_target: | ||
| 10 | types: | ||
| 11 | - labeled | ||
| 12 | - unlabeled | ||
| 13 | permissions: | ||
| 14 | contents: read | ||
| 15 | issues: write | ||
| 16 | pull-requests: write | ||
| 17 | |||
| 18 | jobs: | ||
| 19 | comment: | ||
| 20 | runs-on: ubuntu-20.04 | ||
| 21 | steps: | ||
| 22 | - name: Checkout | ||
| 23 | uses: actions/checkout@v2 | ||
| 24 | - name: Label Commenter | ||
| 25 | uses: peaceiris/actions-label-commenter@v1 | ||
| 26 | with: | ||
| 27 | config_file: .github/issue-auto-comments.yml | ||
| 28 | github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 28 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1,17 +0,0 @@ | |||
| 1 | # Detect and label pull requests that have merge conflicts | ||
| 2 | name: ποΈ Check Merge Conflicts | ||
| 3 | on: | ||
| 4 | push: | ||
| 5 | branches: | ||
| 6 | - staging | ||
| 7 | jobs: | ||
| 8 | check-conflicts: | ||
| 9 | if: github.repository == 'SillyTavern/SillyTavern' | ||
| 10 | runs-on: ubuntu-latest | ||
| 11 | steps: | ||
| 12 | - uses: mschilde/auto-label-merge-conflicts@master | ||
| 13 | with: | ||
| 14 | CONFLICT_LABEL_NAME: "π« Merge Conflicts" | ||
| 15 | GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 16 | MAX_RETRIES: 5 | ||
| 17 | WAIT_MS: 5000 | ||
| 17 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1,82 +0,0 @@ | |||
| 1 | # Closes any issues that no longer have user interaction | ||
| 2 | name: π― Close Stale Issues | ||
| 3 | |||
| 4 | on: | ||
| 5 | workflow_dispatch: | ||
| 6 | schedule: | ||
| 7 | - cron: '0 0 * * *' # Runs every day at midnight UTC | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | stale: | ||
| 11 | runs-on: ubuntu-latest | ||
| 12 | |||
| 13 | steps: | ||
| 14 | # Comment on, then close issues that haven't been updated for ages | ||
| 15 | - name: Close Stale Issues | ||
| 16 | uses: actions/stale@v4 | ||
| 17 | with: | ||
| 18 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 19 | days-before-stale: 183 | ||
| 20 | days-before-close: 7 | ||
| 21 | operations-per-run: 30 | ||
| 22 | remove-stale-when-updated: true | ||
| 23 | enable-statistics: true | ||
| 24 | stale-issue-message: > | ||
| 25 | This issue has gone 6 months without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. | ||
| 26 | Otherwise it will be closed in 7 days. | ||
| 27 | stale-pr-message: > | ||
| 28 | This PR is stale because it has been open 6 months with no activity. Either remove the stale label or comment below with a short update, | ||
| 29 | otherwise this PR will be closed in 7 days. | ||
| 30 | close-issue-message: > | ||
| 31 | This issue was automatically closed because it has been stalled for over 6 months with no activity. | ||
| 32 | close-pr-message: > | ||
| 33 | This pull request was automatically closed because it has been stalled for over 6 months with no activity. | ||
| 34 | stale-issue-label: 'β°οΈ Stale' | ||
| 35 | close-issue-label: 'πΈοΈ Inactive' | ||
| 36 | stale-pr-label: 'β°οΈ Stale' | ||
| 37 | close-pr-label: 'πΈοΈ Inactive' | ||
| 38 | exempt-issue-labels: 'π Keep Open' | ||
| 39 | exempt-pr-labels: 'π Keep Open' | ||
| 40 | labels-to-add-when-unstale: 'π Keep Open' | ||
| 41 | |||
| 42 | # Comment on, then close issues that required a response from the user, but didn't get one | ||
| 43 | - name: Close Issues without Response | ||
| 44 | uses: actions/stale@v4 | ||
| 45 | with: | ||
| 46 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 47 | days-before-stale: 7 | ||
| 48 | days-before-close: 7 | ||
| 49 | operations-per-run: 30 | ||
| 50 | remove-stale-when-updated: true | ||
| 51 | stale-issue-message: > | ||
| 52 | Hi! Looks like additional info is required for this issue to be addressed. | ||
| 53 | Don't forget to provide this within the next few days to keep your ticket open. | ||
| 54 | close-issue-message: 'Issue closed due to no response from user.' | ||
| 55 | only-labels: 'π Awaiting User Response' | ||
| 56 | labels-to-remove-when-unstale: 'π Awaiting User Response, π No Response' | ||
| 57 | stale-issue-label: 'π No Response' | ||
| 58 | close-issue-label: 'πΈοΈ Inactive' | ||
| 59 | exempt-issue-labels: 'π Keep Open' | ||
| 60 | exempt-pr-labels: 'π Keep Open' | ||
| 61 | |||
| 62 | # Comment on issues that we should have replied to | ||
| 63 | - name: Notify Repo Owner to Respond | ||
| 64 | uses: actions/stale@v4 | ||
| 65 | with: | ||
| 66 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 67 | days-before-stale: 7 | ||
| 68 | days-before-close: 183 | ||
| 69 | operations-per-run: 30 | ||
| 70 | remove-stale-when-updated: true | ||
| 71 | stale-issue-message: Hey SillyTavern, - Don't forget to respond! | ||
| 72 | stale-pr-message: Hey SillyTavern, - Don't forget to respond! | ||
| 73 | only-labels: 'π€ Awaiting Maintainer Response' | ||
| 74 | labels-to-remove-when-unstale: 'π€ Awaiting Maintainer Response' | ||
| 75 | close-issue-message: 'Closed due to no response from repo author for over a year' | ||
| 76 | close-pr-message: 'Closed due to no response from repo author for over a year' | ||
| 77 | stale-issue-label: 'π€ Awaiting Maintainer Response' | ||
| 78 | stale-pr-label: 'π€ Awaiting Maintainer Response' | ||
| 79 | close-issue-label: 'πΈοΈ Inactive' | ||
| 80 | close-pr-label: 'πΈοΈ Inactive' | ||
| 81 | exempt-issue-labels: 'π Keep Open' | ||
| 82 | exempt-pr-labels: 'π Keep Open' | ||
| @@ -1,39 +0,0 @@ | |||
| 1 | # Adds a comment to new PRs, showing the compressed size and size difference of new code | ||
| 2 | # And also labels the PR based on the number of lines changes | ||
| 3 | |||
| 4 | name: π Check PR Size | ||
| 5 | on: [pull_request] | ||
| 6 | jobs: | ||
| 7 | build: | ||
| 8 | runs-on: ubuntu-latest | ||
| 9 | steps: | ||
| 10 | - name: Checkout | ||
| 11 | uses: actions/checkout@v2 | ||
| 12 | # Find and comment with compressed size | ||
| 13 | - name: Get Compressed Size | ||
| 14 | uses: preactjs/compressed-size-action@v2 | ||
| 15 | with: | ||
| 16 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 17 | pattern: './dist/**/*.{js,css,html}' | ||
| 18 | strip-hash: '\\b\\w{8}\\.' | ||
| 19 | exclude: '**/node_modules/**' | ||
| 20 | minimum-change-threshold: 100 | ||
| 21 | # Check number of lines of code added | ||
| 22 | - name: Label based on Lines of Code | ||
| 23 | uses: codelytv/pr-size-labeler@v1 | ||
| 24 | with: | ||
| 25 | GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 26 | xs_max_size: '10' | ||
| 27 | s_max_size: '100' | ||
| 28 | m_max_size: '500' | ||
| 29 | l_max_size: '1000' | ||
| 30 | s_label: 'π© PR - Small' | ||
| 31 | m_label: 'π¨ PR - Medium' | ||
| 32 | l_label: 'π§ PR - Large' | ||
| 33 | xl_label: 'π₯ PR - XL' | ||
| 34 | fail_if_xl: 'false' | ||
| 35 | message_if_xl: > | ||
| 36 | It looks like this PR is very large (over 1000 lines). | ||
| 37 | Try to avoid addressing multiple issues in a single PR, and | ||
| 38 | in the future consider breaking large tasks down into smaller steps. | ||
| 39 | This it to make reviewing, testing, reverting and general quality management easier. | ||
| 39 | \ No newline at end of file | \ No newline at end of file | |
| @@ -0,0 +1,107 @@ | |||
| 1 | name: π― Issues Manager | ||
| 2 | |||
| 3 | on: | ||
| 4 | issues: | ||
| 5 | types: [opened, edited, labeled, unlabeled] | ||
| 6 | # Re also listen to comments, to remove stale labels right away | ||
| 7 | issue_comment: | ||
| 8 | types: [created] | ||
| 9 | |||
| 10 | jobs: | ||
| 11 | label-on-content: | ||
| 12 | name: Auto-Label Issues (Based on Issue Content) | ||
| 13 | runs-on: ubuntu-latest | ||
| 14 | |||
| 15 | steps: | ||
| 16 | - name: Auto-Label Issues (Based on Issue Content) | ||
| 17 | # only auto label based on issue content once, on open (to prevent re-labeling removed labels) | ||
| 18 | if: github.event.action == 'opened' | ||
| 19 | |||
| 20 | # Issue Labeler | ||
| 21 | # https://github.com/marketplace/actions/regex-issue-labeler | ||
| 22 | uses: github/issue-labeler@v3 | ||
| 23 | with: | ||
| 24 | configuration-path: .github/issues-auto-labels.yml | ||
| 25 | enable-versioned-regex: 0 | ||
| 26 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 27 | |||
| 28 | label-on-labels: | ||
| 29 | name: Auto-Label Issues (Based on Issue Labels) | ||
| 30 | runs-on: ubuntu-latest | ||
| 31 | |||
| 32 | steps: | ||
| 33 | - name: β Add "π Approved" for relevant labels | ||
| 34 | if: contains(fromJSON('["π©βπ» Good First Issue", "π Help Wanted", "πͺ² Confirmed", "β οΈ High Priority", "β Medium Priority", "π€ Low Priority"]'), github.event.label.name) | ||
| 35 | # π€ Issues Helper | ||
| 36 | # https://github.com/marketplace/actions/issues-helper | ||
| 37 | uses: actions-cool/issues-helper@v3 | ||
| 38 | with: | ||
| 39 | actions: 'add-labels' | ||
| 40 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 41 | labels: 'π Approved' | ||
| 42 | |||
| 43 | - name: β Remove progress labels when issue is marked done or stale | ||
| 44 | if: contains(fromJSON('["β Done", "β Done (staging)", "β°οΈ Stale", "β wontfix"]'), github.event.label.name) | ||
| 45 | # π€ Issues Helper | ||
| 46 | # https://github.com/marketplace/actions/issues-helper | ||
| 47 | uses: actions-cool/issues-helper@v3 | ||
| 48 | with: | ||
| 49 | actions: 'remove-labels' | ||
| 50 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 51 | labels: 'π§βπ» In Progress,π€ Unsure,π€ Under Consideration' | ||
| 52 | |||
| 53 | - name: β Remove temporary labels when confirmed labels are added | ||
| 54 | if: contains(fromJSON('["β wontfix","π Approved","π©βπ» Good First Issue"]'), github.event.label.name) | ||
| 55 | # π€ Issues Helper | ||
| 56 | # https://github.com/marketplace/actions/issues-helper | ||
| 57 | uses: actions-cool/issues-helper@v3 | ||
| 58 | with: | ||
| 59 | actions: 'remove-labels' | ||
| 60 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 61 | labels: 'π€ Unsure,π€ Under Consideration' | ||
| 62 | |||
| 63 | - name: β Remove no bug labels when "πͺ² Confirmed" is added | ||
| 64 | if: github.event.label.name == 'πͺ² Confirmed' | ||
| 65 | # π€ Issues Helper | ||
| 66 | # https://github.com/marketplace/actions/issues-helper | ||
| 67 | uses: actions-cool/issues-helper@v3 | ||
| 68 | with: | ||
| 69 | actions: 'remove-labels' | ||
| 70 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 71 | labels: 'βοΈ Not Reproducible,βοΈ Not A Bug' | ||
| 72 | |||
| 73 | remove-stale-label: | ||
| 74 | name: Remove Stale Label on Comment | ||
| 75 | runs-on: ubuntu-latest | ||
| 76 | # Only run this on new comments, to automatically remove the stale label | ||
| 77 | if: github.event_name == 'issue_comment' && github.actor != 'github-actions[bot]' | ||
| 78 | |||
| 79 | steps: | ||
| 80 | - name: Remove Stale Label | ||
| 81 | # π€ Issues Helper | ||
| 82 | # https://github.com/marketplace/actions/issues-helper | ||
| 83 | uses: actions-cool/issues-helper@v3 | ||
| 84 | with: | ||
| 85 | actions: 'remove-labels' | ||
| 86 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 87 | issue-number: ${{ github.event.issue.number }} | ||
| 88 | labels: 'β°οΈ Stale,πΈοΈ Inactive,π Awaiting User Response,π No Response' | ||
| 89 | |||
| 90 | write-auto-comments: | ||
| 91 | name: Post Issue Comments Based on Labels | ||
| 92 | needs: [label-on-content, label-on-labels] | ||
| 93 | runs-on: ubuntu-latest | ||
| 94 | |||
| 95 | steps: | ||
| 96 | - name: Checkout Repository | ||
| 97 | # Checkout | ||
| 98 | # https://github.com/marketplace/actions/checkout | ||
| 99 | uses: actions/checkout@v4 | ||
| 100 | |||
| 101 | - name: Post Issue Comments Based on Labels | ||
| 102 | # Label Commenter | ||
| 103 | # https://github.com/marketplace/actions/label-commenter | ||
| 104 | uses: peaceiris/actions-label-commenter@v1 | ||
| 105 | with: | ||
| 106 | config_file: .github/issues-auto-comments.yml | ||
| 107 | github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| @@ -0,0 +1,39 @@ | |||
| 1 | name: π― Update Issues on Push | ||
| 2 | |||
| 3 | on: | ||
| 4 | push: | ||
| 5 | branches: | ||
| 6 | - staging | ||
| 7 | - release | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | # This runs commits to staging/release, reading the commit messages. Check `pr-auto-manager.yml`:`update-linked-issues` for PR-linked updates. | ||
| 11 | update-linked-issues: | ||
| 12 | name: Update Issues on Push | ||
| 13 | runs-on: ubuntu-latest | ||
| 14 | |||
| 15 | steps: | ||
| 16 | - name: Checkout Repository | ||
| 17 | # Checkout | ||
| 18 | # https://github.com/marketplace/actions/checkout | ||
| 19 | uses: actions/checkout@v4 | ||
| 20 | |||
| 21 | - name: Extract Linked Issues from Commit Message | ||
| 22 | id: extract_issues | ||
| 23 | run: | | ||
| 24 | ISSUES=$(git log -1 --pretty=%B | grep -oiE '(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) #([0-9]+)' | awk '{print $2}' | tr -d '#' | jq -R -s -c 'split("\n")[:-1]') | ||
| 25 | echo "issues=$ISSUES" >> $GITHUB_ENV | ||
| 26 | |||
| 27 | - name: Label Linked Issues | ||
| 28 | id: label_linked_issues | ||
| 29 | env: | ||
| 30 | GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 31 | run: | | ||
| 32 | for ISSUE in $(echo $issues | jq -r '.[]'); do | ||
| 33 | echo "Updating issue #$ISSUE" | ||
| 34 | if [ "${{ github.ref }}" == "refs/heads/staging" ]; then | ||
| 35 | gh issue edit $ISSUE -R ${{ github.repository }} --add-label "β Done (staging)" | ||
| 36 | elif [ "${{ github.ref }}" == "refs/heads/release" ]; then | ||
| 37 | gh issue edit $ISSUE -R ${{ github.repository }} --add-label "β Done" | ||
| 38 | fi | ||
| 39 | done | ||
| @@ -0,0 +1,95 @@ | |||
| 1 | name: π― Close Stale Issues/PRs Workflow | ||
| 2 | |||
| 3 | on: | ||
| 4 | # Run the workflow every day | ||
| 5 | workflow_dispatch: | ||
| 6 | schedule: | ||
| 7 | - cron: '0 0 * * *' # Runs every day at midnight UTC | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | mark-inactivity: | ||
| 11 | name: Mark Issues/PRs without Activity | ||
| 12 | runs-on: ubuntu-latest | ||
| 13 | |||
| 14 | steps: | ||
| 15 | - name: Mark Issues/PRs without Activity | ||
| 16 | # Close Stale Issues and PRs | ||
| 17 | # https://github.com/marketplace/actions/close-stale-issues | ||
| 18 | uses: actions/stale@v9 | ||
| 19 | with: | ||
| 20 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 21 | days-before-stale: 183 | ||
| 22 | days-before-close: 7 | ||
| 23 | operations-per-run: 30 | ||
| 24 | remove-stale-when-updated: true | ||
| 25 | enable-statistics: true | ||
| 26 | stale-issue-message: > | ||
| 27 | β³ This issue has been inactive for 6 months. If it's still relevant, drop a comment below to keep it open. | ||
| 28 | Otherwise, it will be auto-closed in 7 days. | ||
| 29 | stale-pr-message: > | ||
| 30 | β³ This PR has been inactive for 6 months. If it's still relevant, update it or remove the stale label. | ||
| 31 | Otherwise, it will be auto-closed in 7 days. | ||
| 32 | close-issue-message: > | ||
| 33 | π This issue was auto-closed due to inactivity for over 6 months. | ||
| 34 | close-pr-message: > | ||
| 35 | π This PR was auto-closed due to inactivity for over 6 months. | ||
| 36 | stale-issue-label: 'β°οΈ Stale' | ||
| 37 | close-issue-label: 'πΈοΈ Inactive' | ||
| 38 | stale-pr-label: 'β°οΈ Stale' | ||
| 39 | close-pr-label: 'πΈοΈ Inactive' | ||
| 40 | exempt-issue-labels: 'π Keep Open' | ||
| 41 | exempt-pr-labels: 'π Keep Open' | ||
| 42 | |||
| 43 | await-user-response: | ||
| 44 | name: Mark Issues/PRs Awaiting User Response | ||
| 45 | runs-on: ubuntu-latest | ||
| 46 | needs: mark-inactivity | ||
| 47 | |||
| 48 | steps: | ||
| 49 | - name: Mark Issues/PRs Awaiting User Response | ||
| 50 | # Close Stale Issues and PRs | ||
| 51 | # https://github.com/marketplace/actions/close-stale-issues | ||
| 52 | uses: actions/stale@v9 | ||
| 53 | with: | ||
| 54 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 55 | days-before-stale: 7 | ||
| 56 | days-before-close: 7 | ||
| 57 | operations-per-run: 30 | ||
| 58 | remove-stale-when-updated: true | ||
| 59 | stale-issue-message: > | ||
| 60 | β οΈ Hey! We need some more info to move forward with this issue. | ||
| 61 | Please provide the requested details in the next few days to keep this ticket open. | ||
| 62 | close-issue-message: > | ||
| 63 | π This issue was auto-closed due to no response from user. | ||
| 64 | only-labels: 'π Awaiting User Response' | ||
| 65 | labels-to-remove-when-unstale: 'π Awaiting User Response' | ||
| 66 | stale-issue-label: 'π No Response' | ||
| 67 | close-issue-label: 'πΈοΈ Inactive' | ||
| 68 | exempt-issue-labels: 'π§ Alternative Exists' | ||
| 69 | |||
| 70 | alternative-exists: | ||
| 71 | name: Mark Issues with Alternative Exists | ||
| 72 | runs-on: ubuntu-latest | ||
| 73 | needs: await-user-response | ||
| 74 | |||
| 75 | steps: | ||
| 76 | - name: Mark Issues with Alternative Exists | ||
| 77 | # Close Stale Issues and PRs | ||
| 78 | # https://github.com/marketplace/actions/close-stale-issues | ||
| 79 | uses: actions/stale@v9 | ||
| 80 | with: | ||
| 81 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 82 | days-before-stale: 7 | ||
| 83 | days-before-close: 7 | ||
| 84 | operations-per-run: 30 | ||
| 85 | remove-stale-when-updated: true | ||
| 86 | stale-issue-message: > | ||
| 87 | π An alternative solution has been provided for this issue. | ||
| 88 | Did this solve your problem? If so, we'll go ahead and close it. | ||
| 89 | If you still need help, drop a comment within the next 7 days to keep this open. | ||
| 90 | close-issue-message: > | ||
| 91 | β Closing this issue due to no confirmation on the alternative solution. | ||
| 92 | only-labels: 'π§ Alternative Exists' | ||
| 93 | stale-issue-label: 'π Awaiting User Response' | ||
| 94 | close-issue-label: 'πΈοΈ Inactive' | ||
| 95 | exempt-issue-labels: 'π Keep Open' | ||
| @@ -1,19 +0,0 @@ | |||
| 1 | name: "Issue Labeler" | ||
| 2 | on: | ||
| 3 | issues: | ||
| 4 | types: [opened, edited] | ||
| 5 | |||
| 6 | permissions: | ||
| 7 | issues: write | ||
| 8 | contents: read | ||
| 9 | |||
| 10 | jobs: | ||
| 11 | triage: | ||
| 12 | runs-on: ubuntu-latest | ||
| 13 | steps: | ||
| 14 | - uses: github/issue-labeler@v3.4 | ||
| 15 | with: | ||
| 16 | configuration-path: .github/labeler.yml | ||
| 17 | # not-before: 2020-01-15T02:54:32Z # optional and will result in any issues prior to this timestamp to be ignored. | ||
| 18 | enable-versioned-regex: 0 | ||
| 19 | repo-token: ${{ github.token }} | ||
| 19 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1,17 +0,0 @@ | |||
| 1 | # When a new comment is added to an issue, if it had the Stale or Awaiting User Response labels, then those labels will be removed | ||
| 2 | |||
| 3 | name: π― Remove Pending Labels on Close | ||
| 4 | on: | ||
| 5 | issues: | ||
| 6 | types: [closed] | ||
| 7 | jobs: | ||
| 8 | remove-labels: | ||
| 9 | runs-on: ubuntu-latest | ||
| 10 | steps: | ||
| 11 | - name: Remove Labels when Closed | ||
| 12 | uses: actions-cool/issues-helper@v2 | ||
| 13 | with: | ||
| 14 | actions: remove-labels | ||
| 15 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 16 | issue-number: ${{ github.event.issue.number }} | ||
| 17 | labels: 'π Awaiting User Response,β°οΈ Stale,π€ Awaiting Maintainer Response' | ||
| 17 | \ No newline at end of file | \ No newline at end of file | |
| @@ -1,42 +0,0 @@ | |||
| 1 | # When a new comment is added to an issue, if it had the Stale or Awaiting User Response labels, then those labels will be removed | ||
| 2 | |||
| 3 | name: π― Add/ Remove Awaiting Response Labels | ||
| 4 | on: | ||
| 5 | issue_comment: | ||
| 6 | types: [created] | ||
| 7 | jobs: | ||
| 8 | remove-stale: | ||
| 9 | runs-on: ubuntu-latest | ||
| 10 | if: ${{ github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' }} | ||
| 11 | steps: | ||
| 12 | - name: Remove Stale labels when Updated | ||
| 13 | uses: actions-cool/issues-helper@v2 | ||
| 14 | with: | ||
| 15 | actions: remove-labels | ||
| 16 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 17 | issue-number: ${{ github.event.issue.number }} | ||
| 18 | labels: 'π Awaiting User Response,β°οΈ Stale' | ||
| 19 | |||
| 20 | add-awaiting-author: | ||
| 21 | runs-on: ubuntu-latest | ||
| 22 | if: ${{!github.event.issue.pull_request && github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' && github.event.issue.state == 'open' }} | ||
| 23 | steps: | ||
| 24 | - name: Add Awaiting Author labels when Updated | ||
| 25 | uses: actions-cool/issues-helper@v2 | ||
| 26 | with: | ||
| 27 | actions: add-labels | ||
| 28 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 29 | issue-number: ${{ github.event.issue.number }} | ||
| 30 | labels: 'π€ Awaiting Maintainer Response' | ||
| 31 | |||
| 32 | remove-awaiting-author: | ||
| 33 | runs-on: ubuntu-latest | ||
| 34 | if: ${{ github.event.comment.author_association == 'OWNER' }} | ||
| 35 | steps: | ||
| 36 | - name: Remove Awaiting Author labels when Updated | ||
| 37 | uses: actions-cool/issues-helper@v2 | ||
| 38 | with: | ||
| 39 | actions: remove-labels | ||
| 40 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 41 | issue-number: ${{ github.event.issue.number }} | ||
| 42 | labels: 'π€ Awaiting Maintainer Response' | ||
| 42 | \ No newline at end of file | \ No newline at end of file | |
| @@ -0,0 +1,23 @@ | |||
| 1 | name: π― Issues/PRs On Close Handler | ||
| 2 | |||
| 3 | on: | ||
| 4 | issues: | ||
| 5 | types: [closed] | ||
| 6 | pull_request_target: | ||
| 7 | types: [closed] | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | remove-labels: | ||
| 11 | name: Remove Pending Labels on Close | ||
| 12 | runs-on: ubuntu-latest | ||
| 13 | |||
| 14 | steps: | ||
| 15 | - name: Remove Pending Labels on Close | ||
| 16 | # π€ Issues Helper | ||
| 17 | # https://github.com/marketplace/actions/issues-helper | ||
| 18 | uses: actions-cool/issues-helper@v3 | ||
| 19 | with: | ||
| 20 | actions: remove-labels | ||
| 21 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 22 | issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} | ||
| 23 | labels: 'π Awaiting User Response,π§βπ» In Progress,π Keep Open,π« Merge Conflicts,π¬ Needs Testing,π¨ Needs Work,β°οΈ Stale,β Waiting For External/Upstream' | ||
| @@ -0,0 +1,50 @@ | |||
| 1 | name: π― Issues/PRs Open Handler | ||
| 2 | |||
| 3 | on: | ||
| 4 | issues: | ||
| 5 | types: [opened] | ||
| 6 | pull_request_target: | ||
| 7 | types: [opened] | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | label-maintainer: | ||
| 11 | name: Label if Author is a Repo Maintainer | ||
| 12 | runs-on: ubuntu-latest | ||
| 13 | |||
| 14 | steps: | ||
| 15 | - name: Label if Author is a Repo Maintainer | ||
| 16 | # GitHub Script | ||
| 17 | # https://github.com/marketplace/actions/github-script | ||
| 18 | uses: actions/github-script@v7 | ||
| 19 | with: | ||
| 20 | script: | | ||
| 21 | // Get basic info | ||
| 22 | const { owner, repo } = context.repo; | ||
| 23 | const payload = context.payload; | ||
| 24 | // Determine if it's an issue or a pull request | ||
| 25 | const eventData = payload.issue || payload.pull_request; | ||
| 26 | const username = eventData.user.login; | ||
| 27 | const issue_number = eventData.number; | ||
| 28 | |||
| 29 | // Get the collaborator permission level for the user | ||
| 30 | const { data: permissionData } = await github.repos.getCollaboratorPermissionLevel({ | ||
| 31 | owner, | ||
| 32 | repo, | ||
| 33 | username, | ||
| 34 | }); | ||
| 35 | |||
| 36 | const permission = permissionData.permission; | ||
| 37 | console.log(`User ${username} has permission level: ${permission}`); | ||
| 38 | |||
| 39 | // Check if user is an admin or has maintain permissions | ||
| 40 | if (['admin', 'maintain'].includes(permission)) { | ||
| 41 | console.log(`Adding "Maintainer" label to issue/PR #${issue_number}`); | ||
| 42 | await github.issues.addLabels({ | ||
| 43 | owner, | ||
| 44 | repo, | ||
| 45 | issue_number, | ||
| 46 | labels: ['π· Maintainer'], | ||
| 47 | }); | ||
| 48 | } else { | ||
| 49 | console.log(`User ${username} is not a repo maintainer.`); | ||
| 50 | } | ||
| @@ -0,0 +1,182 @@ | |||
| 1 | name: π― Pull Request Manager | ||
| 2 | |||
| 3 | on: | ||
| 4 | pull_request_target: | ||
| 5 | types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed] | ||
| 6 | pull_request_review_comment: | ||
| 7 | types: [created] | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | label-by-size: | ||
| 11 | name: Apply Label for PR Size | ||
| 12 | runs-on: ubuntu-latest | ||
| 13 | |||
| 14 | steps: | ||
| 15 | - name: Label PR Size | ||
| 16 | # Pull Request Size Labeler | ||
| 17 | # https://github.com/marketplace/actions/pull-request-size-labeler | ||
| 18 | uses: codelytv/pr-size-labeler@v1 | ||
| 19 | with: | ||
| 20 | GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 21 | xs_label: 'π© ⬀ββββ' | ||
| 22 | xs_max_size: '20' | ||
| 23 | s_label: 'π© ⬀⬀βββ' | ||
| 24 | s_max_size: '100' | ||
| 25 | m_label: 'π¨ ⬀⬀⬀ββ' | ||
| 26 | m_max_size: '500' | ||
| 27 | l_label: 'π§ ⬀⬀⬀⬀β' | ||
| 28 | l_max_size: '1000' | ||
| 29 | xl_label: 'π₯ ⬀⬀⬀⬀⬀' | ||
| 30 | fail_if_xl: 'false' | ||
| 31 | github_api_url: 'https://api.github.com' | ||
| 32 | files_to_ignore: | | ||
| 33 | "package-lock.json" | ||
| 34 | "public/lib/*" | ||
| 35 | |||
| 36 | label-by-branches: | ||
| 37 | name: Apply Labels Based on Branch Name and Target Branch | ||
| 38 | runs-on: ubuntu-latest | ||
| 39 | # Only label once when PR is created or branches are changed, to allow manual label removal | ||
| 40 | if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head)) | ||
| 41 | |||
| 42 | steps: | ||
| 43 | - name: Apply Labels Based on Branch Name and Target Branch | ||
| 44 | # Pull Request Labeler | ||
| 45 | # https://github.com/marketplace/actions/labeler | ||
| 46 | uses: actions/labeler@v5 | ||
| 47 | with: | ||
| 48 | configuration-path: .github/pr-auto-labels-by-branch.yml | ||
| 49 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 50 | |||
| 51 | label-by-files: | ||
| 52 | name: Apply Labels Based on Changed Files | ||
| 53 | runs-on: ubuntu-latest | ||
| 54 | |||
| 55 | steps: | ||
| 56 | - name: Apply Labels Based on Changed Files | ||
| 57 | # Pull Request Labeler | ||
| 58 | # https://github.com/marketplace/actions/labeler | ||
| 59 | uses: actions/labeler@v5 | ||
| 60 | with: | ||
| 61 | configuration-path: .github/pr-auto-labels-by-files.yml | ||
| 62 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 63 | |||
| 64 | remove-stale-label: | ||
| 65 | name: Remove Stale Label on Comment | ||
| 66 | runs-on: ubuntu-latest | ||
| 67 | # Only runs when this is not done by the github actions bot | ||
| 68 | if: github.actor != 'github-actions[bot]' | ||
| 69 | |||
| 70 | steps: | ||
| 71 | - name: Remove Stale Label | ||
| 72 | # π€ Issues Helper | ||
| 73 | # https://github.com/marketplace/actions/issues-helper | ||
| 74 | uses: actions-cool/issues-helper@v3 | ||
| 75 | with: | ||
| 76 | actions: 'remove-labels' | ||
| 77 | token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 78 | issue-number: ${{ github.event.pull_request.number }} | ||
| 79 | labels: 'β°οΈ Stale' | ||
| 80 | |||
| 81 | check-merge-blocking-labels: | ||
| 82 | name: Check Merge Blocking Labels | ||
| 83 | needs: [label-by-branches, label-by-files] | ||
| 84 | runs-on: ubuntu-latest | ||
| 85 | # Run, even if the previous jobs were skipped/failed | ||
| 86 | if: always() | ||
| 87 | |||
| 88 | steps: | ||
| 89 | - name: Check Merge Blocking | ||
| 90 | # GitHub Script | ||
| 91 | # https://github.com/marketplace/actions/github-scriptLabels | ||
| 92 | id: label-check | ||
| 93 | uses: actions/github-script@v7 | ||
| 94 | with: | ||
| 95 | script: | | ||
| 96 | const prLabels = context.payload.pull_request.labels.map(label => label.name); | ||
| 97 | const blockingLabels = [ | ||
| 98 | "β Don't Merge", | ||
| 99 | "π¨ Needs Work", | ||
| 100 | "π¬ Needs Testing", | ||
| 101 | "β Waiting For External/Upstream", | ||
| 102 | "β Against Release Branch", | ||
| 103 | "π₯π£ Breaking Changes" | ||
| 104 | ]; | ||
| 105 | const hasBlockingLabel = prLabels.some(label => blockingLabels.includes(label)); | ||
| 106 | |||
| 107 | if (hasBlockingLabel) { | ||
| 108 | console.log("Blocking label detected. Setting warning status."); | ||
| 109 | await github.rest.checks.create({ | ||
| 110 | owner: context.repo.owner, | ||
| 111 | repo: context.repo.repo, | ||
| 112 | name: "PR Label Warning", | ||
| 113 | head_sha: context.payload.pull_request.head.sha, | ||
| 114 | status: "completed", | ||
| 115 | conclusion: "neutral", | ||
| 116 | output: { | ||
| 117 | title: "Potential Merge Issue", | ||
| 118 | summary: "This PR has a merge-blocking label. Proceed with caution." | ||
| 119 | } | ||
| 120 | }); | ||
| 121 | } else { | ||
| 122 | console.log("No merge-blocking labels found."); | ||
| 123 | } | ||
| 124 | |||
| 125 | write-auto-comments: | ||
| 126 | name: Post PR Comments Based on Labels | ||
| 127 | needs: [label-by-size, label-by-branches, label-by-files] | ||
| 128 | runs-on: ubuntu-latest | ||
| 129 | # Run, even if the previous jobs were skipped/failed | ||
| 130 | if: always() | ||
| 131 | |||
| 132 | steps: | ||
| 133 | - name: Checkout Repository | ||
| 134 | # Checkout | ||
| 135 | # https://github.com/marketplace/actions/checkout | ||
| 136 | uses: actions/checkout@v4 | ||
| 137 | |||
| 138 | - name: Post PR Comments Based on Labels | ||
| 139 | # Label Commenter for PRs | ||
| 140 | # https://github.com/marketplace/actions/label-commenter | ||
| 141 | uses: peaceiris/actions-label-commenter@v1 | ||
| 142 | with: | ||
| 143 | config_file: .github/pr-auto-comments.yml | ||
| 144 | github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 145 | |||
| 146 | # This runs on merged PRs to staging, reading the PR body and directly linked issues. Check `issues-updates-on-merge.yml`:`update-linked-issues` for commit-based updates. | ||
| 147 | update-linked-issues: | ||
| 148 | name: Update Issues on Staging Merge | ||
| 149 | runs-on: ubuntu-latest | ||
| 150 | if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging' | ||
| 151 | |||
| 152 | steps: | ||
| 153 | - name: Extract Linked Issues From PR Description | ||
| 154 | id: extract_issues | ||
| 155 | run: | | ||
| 156 | ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -oiE '(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) #([0-9]+)' | awk '{print $2}' | tr -d '#' | jq -R -s -c 'split("\n")[:-1]') | ||
| 157 | echo "issues=$ISSUES" >> $GITHUB_ENV | ||
| 158 | |||
| 159 | - name: Fetch Directly Linked Issues | ||
| 160 | id: fetch_linked_issues | ||
| 161 | run: | | ||
| 162 | PR_NUMBER=${{ github.event.pull_request.number }} | ||
| 163 | REPO=${{ github.repository }} | ||
| 164 | API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues" | ||
| 165 | ISSUES=$(curl -s -H "Authorization: token ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" "$API_URL" | jq -r '.[].number' | jq -R -s -c 'split("\n")[:-1]') | ||
| 166 | echo "linked_issues=$ISSUES" >> $GITHUB_ENV | ||
| 167 | |||
| 168 | - name: Merge Issue Lists | ||
| 169 | id: merge_issues | ||
| 170 | run: | | ||
| 171 | ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique') | ||
| 172 | echo "final_issues=$ISSUES" >> $GITHUB_ENV | ||
| 173 | |||
| 174 | - name: Label Linked Issues | ||
| 175 | id: label_linked_issues | ||
| 176 | env: | ||
| 177 | GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 178 | run: | | ||
| 179 | for ISSUE in $(echo $final_issues | jq -r '.[]'); do | ||
| 180 | echo "Updating issue #$ISSUE" | ||
| 181 | gh issue edit $ISSUE -R ${{ github.repository }} --add-label "β Done (staging)" | ||
| 182 | done | ||
| @@ -0,0 +1,24 @@ | |||
| 1 | name: π― Push Handler | ||
| 2 | |||
| 3 | on: | ||
| 4 | # So that PRs touching the same files as the push are updated | ||
| 5 | push: | ||
| 6 | # So that the `dirtyLabel` is removed if conflicts are resolved | ||
| 7 | pull_request_target: | ||
| 8 | types: [synchronize] | ||
| 9 | |||
| 10 | jobs: | ||
| 11 | check-merge-conflicts: | ||
| 12 | name: Check Merge Conflicts | ||
| 13 | runs-on: ubuntu-latest | ||
| 14 | |||
| 15 | steps: | ||
| 16 | - name: Check Merge Conflicts | ||
| 17 | # Label Conflicting Pull Requests | ||
| 18 | # https://github.com/marketplace/actions/label-conflicting-pull-requests | ||
| 19 | uses: eps1lon/actions-label-merge-conflict@v3 | ||
| 20 | with: | ||
| 21 | dirtyLabel: 'π« Merge Conflicts' | ||
| 22 | repoToken: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | ||
| 23 | commentOnDirty: > | ||
| 24 | β οΈ This PR has conflicts that need to be resolved before it can be merged. | ||