diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 10734f74e..1ff252a65 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,4 +1,5 @@ name: Bug Report πŸ› +type: Bug 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. title: '[BUG] ' labels: ['πŸ› Bug'] diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index 088a8acf3..04d02e23a 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -1,4 +1,5 @@ name: Feature Request ✨ +type: Feature description: Suggest an idea for future development of this project. Please use English only. title: '[FEATURE_REQUEST] <title>' labels: ['πŸ¦„ Feature Request'] @@ -32,7 +33,7 @@ body: id: solution attributes: label: Describe the solution you'd like - placeholder: An outline of how you would like this to be implemented, include as much details as possible + placeholder: An outline of how you would like this to be implemented, include as much details as possible validations: required: true diff --git a/.github/close-label.yml b/.github/close-label.yml deleted file mode 100644 index 5f2bfa5ee..000000000 --- a/.github/close-label.yml +++ /dev/null @@ -1,2 +0,0 @@ -πŸ› Bug: βœ… Fixed -πŸ¦„ Feature Request: βœ… Implemented \ No newline at end of file diff --git a/.github/issue-auto-comments.yml b/.github/issue-auto-comments.yml deleted file mode 100644 index 8947d4e1a..000000000 --- a/.github/issue-auto-comments.yml +++ /dev/null @@ -1,62 +0,0 @@ -comment: - footer: | - --- - > I am a bot, and this is an automated message πŸ€– -labels: - - name: βœ–οΈ Invalid - labeled: - issue: - action: close - body: > - Hello @{{ issue.user.login }} your ticket has been marked as invalid. - Please ensure you follow the issue template, provide all requested info, - and be sure to check the docs + previous issues prior to raising tickets. - pr: - body: Thank you @{{ pull_request.user.login }} for suggesting this. Please follow the pull request templates. - action: close - - - name: πŸ‘©β€πŸ’» Good First Issue - labeled: - issue: - body: > - This issue has been marked as a good first issue for first-time contributors to implement! - 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. - If you're new to SillyTavern [here are a collection of resources](https://docs.sillytavern.app/) - If you need any support at all, feel free to reach out via [Discord](https://discord.gg/sillytavern). - - - name: ❌ wontfix - labeled: - issue: - action: close - body: > - This ticked has been marked as 'wontfix', which usually means it is out-of-scope, or not feasible at this time. - You can still fork the project and make the changes yourself. - - - name: βœ… Fixed - labeled: - issue: - body: > - Hello @{{ issue.user.login }}! It looks like all or part of this issue has now been implemented. - - - - name: ‼️ High Priority - labeled: - issue: - body: > - This ticket has been marked as high priority, and has been bumped to the top of the priority list. - You should expect an implementation to be pushed out soon. Thank you for your patience. - - - name: πŸ’€ Spam - labeled: - issue: - action: close - locking: lock - lock_reason: spam - body: > - This issue has been identified as spam, and is now locked. - Users who repeatedly raise spam issues may be blocked or reported. - - - name: β›” Don't Merge - labeled: - pr: - body: This PR has been temporarily blocked from merging. \ No newline at end of file diff --git a/.github/issues-auto-comments.yml b/.github/issues-auto-comments.yml new file mode 100644 index 000000000..9c412ffd8 --- /dev/null +++ b/.github/issues-auto-comments.yml @@ -0,0 +1,69 @@ +labels: + - name: βœ–οΈ Invalid + labeled: + issue: + action: close + body: > + Hey @{{ issue.user.login }}, this issue has been marked as invalid. + + Please double-check that you've followed the issue template, included all necessary details, and reviewed the docs & previous issues before submitting. + If provided, follow the instructions given by maintainers. + + - name: πŸ‘©β€πŸ’» Good First Issue + labeled: + issue: + body: > + πŸ† This issue has been marked as a good first issue for contributors to implement! + 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. + + 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). + 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). + + - name: ❌ wontfix + labeled: + issue: + action: close + body: > + ❌ 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. + If you have any questions about this, feel free to reach out. + + - name: πŸ›‘ Out of Scope + labeled: + issue: + action: close + body: > + πŸ›‘ This issue has been marked as 'out of scope', as this can't or won't be implemented. + If you have any questions about this, feel free to reach out. + + - name: βœ… Done (staging) + labeled: + issue: + body: > + βœ… It looks like all or part of this issue has now been implemented as part of the `staging` branch. + If you currently are on the `release` branch, you can switch to `staging` to test this right away. + + Note that `staging` is considered less stable than the official releases. To switch, follow existing instructions, + or simply enter the following command: `git switch staging` + + - name: βœ… Done + labeled: + issue: + body: > + βœ… It looks like all or part of this issue has now been implemented as part of the latest release. + + - name: ‼️ High Priority + labeled: + issue: + body: > + 🚨 This issue has been marked high priority, meaning it's important to the maintainers or community. + While we can't promise immediate changes, it is on our radar and will be addressed whenever possible. Thanks for your patience! + + - name: πŸ’€ Spam + labeled: + issue: + action: close + locking: lock + lock_reason: spam + body: > + πŸ’€ This issue has been flagged as spam and is now locked. + Please avoid posting spam - it disrupts the community and wastes everyone's time. diff --git a/.github/labeler.yml b/.github/issues-auto-labels.yml similarity index 52% rename from .github/labeler.yml rename to .github/issues-auto-labels.yml index 850096c9e..8bfb62009 100644 --- a/.github/labeler.yml +++ b/.github/issues-auto-labels.yml @@ -1,7 +1,3 @@ -# Add/remove 'critical' label if issue contains the words 'urgent' or 'critical' -#critical: -# - '(critical|urgent)' - πŸͺŸ Windows: - '(πŸͺŸ Windows)' @@ -15,4 +11,10 @@ - '(πŸ“± Termux)' 🐧 Linux: - - '(🐧 Linux)' \ No newline at end of file + - '(🐧 Linux)' + +🦊 Firefox: + - '(firefox|mozilla)' + +πŸ“± Mobile: + - '(iphone|ios|android|πŸ“± Termux)' diff --git a/.github/pr-auto-comments.yml b/.github/pr-auto-comments.yml new file mode 100644 index 000000000..bdb3e8022 --- /dev/null +++ b/.github/pr-auto-comments.yml @@ -0,0 +1,51 @@ +labels: + - name: βœ–οΈ Invalid + labeled: + pr: + action: close + body: > + Hey @{{ pull_request.user.login }}, thanks for your contribution! + Unfortunately, this PR has been marked as invalid. + + 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). + + If you need help, feel free to ask! + + - name: β›” Don't Merge + labeled: + pr: + body: > + 🚨 This PR has been temporarily blocked from merging. + + - name: πŸ’₯πŸ’£ Breaking Changes + labeled: + pr: + body: > + ⚠️ Heads up! This PR introduces breaking changes. + + Make sure these changes are well-documented and that users will be properly informed when this is released. + + - name: β›” Waiting For External/Upstream + labeled: + pr: + body: > + β›” This PR is awaiting external or upstream changes or approval. + It can only be merged once those changes have been implemented and approved. + + Please inform us of any progress on the upstream changes or approval. + + - name: πŸ”¬ Needs Testing + labeled: + pr: + body: > + πŸ”¬ This PR needs testing! + Any contributor can test and leave reviews, so feel free to help us out! + + - name: πŸŸ₯ ⬀⬀⬀⬀⬀ + labeled: + pr: + body: > + ⚠️ This PR is over 1000 lines, which is larger than recommended. + + Please make sure that it only addresses a single issue - PRs this large are hard to test and may be rejected. + diff --git a/.github/pr-auto-labels-by-branch.yml b/.github/pr-auto-labels-by-branch.yml new file mode 100644 index 000000000..bbb91d760 --- /dev/null +++ b/.github/pr-auto-labels-by-branch.yml @@ -0,0 +1,77 @@ +#################################### +# Label PRs against 'release' # +#################################### +❗ Against Release Branch: +- base-branch: 'release' + +#################################### +# Labels based on PR branch name # +#################################### +πŸ¦‹ Bug Fix: +- head-branch: ['^fix[/-]', '\bfixes\b'] + +πŸš‘ Hot Fix: +- head-branch: ['^hotfix[/-]'] + +✨ New Feature: +- head-branch: ['^feat(ure)?[/-].*?\badd', '^add-'] + +✨ Feature Changes: +- head-branch: ['^feat(ure)?[/-](?!.*\badd\b)', '\bchanges?\b'] + +πŸ€– API / Model: +- head-branch: ['\bapi\b', '\bmodels?\b'] + +🏭 Backend Changes: +- head-branch: ['\bbackend\b', '\bendpoints?\b'] + +πŸ‹ Docker: +- head-branch: ['\bdocker\b'] + +βž• Extension: +- head-branch: ['\bextension\b', '\bext\b'] + +🦊 Firefox: +- head-branch: ['\bfirefox\b'] + +πŸ–ΌοΈ Image Gen: +- head-branch: ['\bimage-gen\b'] + +🌐 Language: +- head-branch: ['\btranslations?\b', '\blanguages?\b'] + +🐧 Linux: +- head-branch: ['\blinux\b'] + +🧩 Macros: +- head-branch: ['\bmacros?\b'] + +πŸ“± Mobile: +- head-branch: ['\bmobile\b', '\bios\b', '\bandroid\b'] + +πŸš„ Performance: +- head-branch: ['\bperformance\b'] + +βš™οΈ Preset: +- head-branch: ['\bpresets?\b'] + +πŸ“œ Prompt: +- head-branch: ['\bprompt\b'] + +🚚 Refactor: +- head-branch: ['\brefactor(s|ed)?\b'] + +πŸ“œ STscript: +- head-branch: ['\bstscript\b', '\bslash-commands\b'] + +🏷️ Tags / Folders: +- head-branch: ['\btags\b'] + +πŸŽ™οΈ TTS / Voice: +- head-branch: ['\btts\b', '\bvoice\b'] + +🌟 UX: +- head-branch: ['\bux\b'] + +πŸ—ΊοΈ World Info: +- head-branch: ['\bworld-info\b', '\bwi\b'] diff --git a/.github/pr-auto-labels-by-files.yml b/.github/pr-auto-labels-by-files.yml new file mode 100644 index 000000000..55946ad2b --- /dev/null +++ b/.github/pr-auto-labels-by-files.yml @@ -0,0 +1,46 @@ +#################################### +# Labels based on changed files # +#################################### +🏭 Backend Changes: +- changed-files: + - any-glob-to-any-file: + - "src/**" + - "default/config.yaml" + - "server.js" + - "plugins.js" + - "recover.js" + - "webpack.config.js" + - "Start.bat" + - "start.sh" + - "UpdateAndStart.bat" + - "UpdateForkAndStart.bat" + +βš™οΈ config.yaml: +- changed-files: + - any-glob-to-any-file: + - "default/config.yaml" + +πŸ› οΈ Build Changes: +- changed-files: + - any-glob-to-any-file: + - ".github/workflows/**" + - "docker/**" + - ".dockerignore" + - "Dockerfile" + - "webpack.config.js" + +🌐 Language: +- changed-files: + - any-glob-to-any-file: + - "public/locales/**" + +πŸ“₯ Dependencies: +- changed-files: + - any-glob-to-any-file: + - "public/lib/**" # Every frontend lib counts as a dependency as well + - "package.json" + - "package-lock.json" + - "tests/package.json" + - "tests/package-lock.json" + - "src/electron/package.json" + - "src/electron/package-lock.json" diff --git a/.github/workflows/add-comment-from-tag.yml b/.github/workflows/add-comment-from-tag.yml deleted file mode 100644 index 548f83eac..000000000 --- a/.github/workflows/add-comment-from-tag.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Based on a label applied to an issue, the bot will add a comment with some additional info - -name: 🎯 Auto-Reply to Labeled Tickets -on: - issues: - types: - - labeled - - unlabeled - pull_request_target: - types: - - labeled - - unlabeled -permissions: - contents: read - issues: write - pull-requests: write - -jobs: - comment: - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Label Commenter - uses: peaceiris/actions-label-commenter@v1 - with: - config_file: .github/issue-auto-comments.yml - github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/check-merge-conflicts.yml b/.github/workflows/check-merge-conflicts.yml deleted file mode 100644 index 720723558..000000000 --- a/.github/workflows/check-merge-conflicts.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Detect and label pull requests that have merge conflicts -name: πŸ—οΈ Check Merge Conflicts -on: - push: - branches: - - staging -jobs: - check-conflicts: - if: github.repository == 'SillyTavern/SillyTavern' - runs-on: ubuntu-latest - steps: - - uses: mschilde/auto-label-merge-conflicts@master - with: - CONFLICT_LABEL_NAME: "🚫 Merge Conflicts" - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - MAX_RETRIES: 5 - WAIT_MS: 5000 \ No newline at end of file diff --git a/.github/workflows/close-stale-issues.yml b/.github/workflows/close-stale-issues.yml deleted file mode 100644 index 1d4382592..000000000 --- a/.github/workflows/close-stale-issues.yml +++ /dev/null @@ -1,82 +0,0 @@ -# Closes any issues that no longer have user interaction -name: 🎯 Close Stale Issues - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' # Runs every day at midnight UTC - -jobs: - stale: - runs-on: ubuntu-latest - - steps: - # Comment on, then close issues that haven't been updated for ages - - name: Close Stale Issues - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - days-before-stale: 183 - days-before-close: 7 - operations-per-run: 30 - remove-stale-when-updated: true - enable-statistics: true - stale-issue-message: > - 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. - Otherwise it will be closed in 7 days. - stale-pr-message: > - 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, - otherwise this PR will be closed in 7 days. - close-issue-message: > - This issue was automatically closed because it has been stalled for over 6 months with no activity. - close-pr-message: > - This pull request was automatically closed because it has been stalled for over 6 months with no activity. - stale-issue-label: '⚰️ Stale' - close-issue-label: 'πŸ•ΈοΈ Inactive' - stale-pr-label: '⚰️ Stale' - close-pr-label: 'πŸ•ΈοΈ Inactive' - exempt-issue-labels: 'πŸ“Œ Keep Open' - exempt-pr-labels: 'πŸ“Œ Keep Open' - labels-to-add-when-unstale: 'πŸ“Œ Keep Open' - - # Comment on, then close issues that required a response from the user, but didn't get one - - name: Close Issues without Response - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - days-before-stale: 7 - days-before-close: 7 - operations-per-run: 30 - remove-stale-when-updated: true - stale-issue-message: > - Hi! Looks like additional info is required for this issue to be addressed. - Don't forget to provide this within the next few days to keep your ticket open. - close-issue-message: 'Issue closed due to no response from user.' - only-labels: '🚏 Awaiting User Response' - labels-to-remove-when-unstale: '🚏 Awaiting User Response, πŸ›‘ No Response' - stale-issue-label: 'πŸ›‘ No Response' - close-issue-label: 'πŸ•ΈοΈ Inactive' - exempt-issue-labels: 'πŸ“Œ Keep Open' - exempt-pr-labels: 'πŸ“Œ Keep Open' - - # Comment on issues that we should have replied to - - name: Notify Repo Owner to Respond - uses: actions/stale@v4 - with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - days-before-stale: 7 - days-before-close: 183 - operations-per-run: 30 - remove-stale-when-updated: true - stale-issue-message: Hey SillyTavern, - Don't forget to respond! - stale-pr-message: Hey SillyTavern, - Don't forget to respond! - only-labels: 'πŸ‘€ Awaiting Maintainer Response' - labels-to-remove-when-unstale: 'πŸ‘€ Awaiting Maintainer Response' - close-issue-message: 'Closed due to no response from repo author for over a year' - close-pr-message: 'Closed due to no response from repo author for over a year' - stale-issue-label: 'πŸ‘€ Awaiting Maintainer Response' - stale-pr-label: 'πŸ‘€ Awaiting Maintainer Response' - close-issue-label: 'πŸ•ΈοΈ Inactive' - close-pr-label: 'πŸ•ΈοΈ Inactive' - exempt-issue-labels: 'πŸ“Œ Keep Open' - exempt-pr-labels: 'πŸ“Œ Keep Open' diff --git a/.github/workflows/get-pr-size.yml b/.github/workflows/get-pr-size.yml deleted file mode 100644 index ac5f9d4d3..000000000 --- a/.github/workflows/get-pr-size.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Adds a comment to new PRs, showing the compressed size and size difference of new code -# And also labels the PR based on the number of lines changes - -name: 🌈 Check PR Size -on: [pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - # Find and comment with compressed size - - name: Get Compressed Size - uses: preactjs/compressed-size-action@v2 - with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - pattern: './dist/**/*.{js,css,html}' - strip-hash: '\\b\\w{8}\\.' - exclude: '**/node_modules/**' - minimum-change-threshold: 100 - # Check number of lines of code added - - name: Label based on Lines of Code - uses: codelytv/pr-size-labeler@v1 - with: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - xs_max_size: '10' - s_max_size: '100' - m_max_size: '500' - l_max_size: '1000' - s_label: '🟩 PR - Small' - m_label: '🟨 PR - Medium' - l_label: '🟧 PR - Large' - xl_label: 'πŸŸ₯ PR - XL' - fail_if_xl: 'false' - message_if_xl: > - It looks like this PR is very large (over 1000 lines). - Try to avoid addressing multiple issues in a single PR, and - in the future consider breaking large tasks down into smaller steps. - This it to make reviewing, testing, reverting and general quality management easier. \ No newline at end of file diff --git a/.github/workflows/issues-auto-manager.yml b/.github/workflows/issues-auto-manager.yml new file mode 100644 index 000000000..e35f71b66 --- /dev/null +++ b/.github/workflows/issues-auto-manager.yml @@ -0,0 +1,107 @@ +name: 🎯 Issues Manager + +on: + issues: + types: [opened, edited, labeled, unlabeled] + # Re also listen to comments, to remove stale labels right away + issue_comment: + types: [created] + +jobs: + label-on-content: + name: Auto-Label Issues (Based on Issue Content) + runs-on: ubuntu-latest + + steps: + - name: Auto-Label Issues (Based on Issue Content) + # only auto label based on issue content once, on open (to prevent re-labeling removed labels) + if: github.event.action == 'opened' + + # Issue Labeler + # https://github.com/marketplace/actions/regex-issue-labeler + uses: github/issue-labeler@v3 + with: + configuration-path: .github/issues-auto-labels.yml + enable-versioned-regex: 0 + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + + label-on-labels: + name: Auto-Label Issues (Based on Issue Labels) + runs-on: ubuntu-latest + + steps: + - name: βœ… Add "πŸ‘ Approved" for relevant labels + if: contains(fromJSON('["πŸ‘©β€πŸ’» Good First Issue", "πŸ™ Help Wanted", "πŸͺ² Confirmed", "⚠️ High Priority", "❕ Medium Priority", "πŸ’€ Low Priority"]'), github.event.label.name) + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: 'add-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + labels: 'πŸ‘ Approved' + + - name: ❌ Remove progress labels when issue is marked done or stale + if: contains(fromJSON('["βœ… Done", "βœ… Done (staging)", "⚰️ Stale", "❌ wontfix"]'), github.event.label.name) + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: 'remove-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + labels: 'πŸ§‘β€πŸ’» In Progress,πŸ€” Unsure,πŸ€” Under Consideration' + + - name: ❌ Remove temporary labels when confirmed labels are added + if: contains(fromJSON('["❌ wontfix","πŸ‘ Approved","πŸ‘©β€πŸ’» Good First Issue"]'), github.event.label.name) + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: 'remove-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + labels: 'πŸ€” Unsure,πŸ€” Under Consideration' + + - name: ❌ Remove no bug labels when "πŸͺ² Confirmed" is added + if: github.event.label.name == 'πŸͺ² Confirmed' + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: 'remove-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + labels: 'βœ–οΈ Not Reproducible,βœ–οΈ Not A Bug' + + remove-stale-label: + name: Remove Stale Label on Comment + runs-on: ubuntu-latest + # Only run this on new comments, to automatically remove the stale label + if: github.event_name == 'issue_comment' && github.actor != 'github-actions[bot]' + + steps: + - name: Remove Stale Label + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: 'remove-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + labels: '⚰️ Stale,πŸ•ΈοΈ Inactive,🚏 Awaiting User Response,πŸ›‘ No Response' + + write-auto-comments: + name: Post Issue Comments Based on Labels + needs: [label-on-content, label-on-labels] + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4 + + - name: Post Issue Comments Based on Labels + # Label Commenter + # https://github.com/marketplace/actions/label-commenter + uses: peaceiris/actions-label-commenter@v1 + with: + config_file: .github/issues-auto-comments.yml + github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issues-updates-on-merge.yml b/.github/workflows/issues-updates-on-merge.yml new file mode 100644 index 000000000..a0f091c34 --- /dev/null +++ b/.github/workflows/issues-updates-on-merge.yml @@ -0,0 +1,39 @@ +name: 🎯 Update Issues on Push + +on: + push: + branches: + - staging + - release + +jobs: + # This runs commits to staging/release, reading the commit messages. Check `pr-auto-manager.yml`:`update-linked-issues` for PR-linked updates. + update-linked-issues: + name: Update Issues on Push + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4 + + - name: Extract Linked Issues from Commit Message + id: extract_issues + run: | + 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]') + echo "issues=$ISSUES" >> $GITHUB_ENV + + - name: Label Linked Issues + id: label_linked_issues + env: + GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + for ISSUE in $(echo $issues | jq -r '.[]'); do + echo "Updating issue #$ISSUE" + if [ "${{ github.ref }}" == "refs/heads/staging" ]; then + gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)" + elif [ "${{ github.ref }}" == "refs/heads/release" ]; then + gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done" + fi + done diff --git a/.github/workflows/job-close-stale.yml b/.github/workflows/job-close-stale.yml new file mode 100644 index 000000000..1d9a7de58 --- /dev/null +++ b/.github/workflows/job-close-stale.yml @@ -0,0 +1,95 @@ +name: 🎯 Close Stale Issues/PRs Workflow + +on: + # Run the workflow every day + workflow_dispatch: + schedule: + - cron: '0 0 * * *' # Runs every day at midnight UTC + +jobs: + mark-inactivity: + name: Mark Issues/PRs without Activity + runs-on: ubuntu-latest + + steps: + - name: Mark Issues/PRs without Activity + # Close Stale Issues and PRs + # https://github.com/marketplace/actions/close-stale-issues + uses: actions/stale@v9 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + days-before-stale: 183 + days-before-close: 7 + operations-per-run: 30 + remove-stale-when-updated: true + enable-statistics: true + stale-issue-message: > + ⏳ This issue has been inactive for 6 months. If it's still relevant, drop a comment below to keep it open. + Otherwise, it will be auto-closed in 7 days. + stale-pr-message: > + ⏳ This PR has been inactive for 6 months. If it's still relevant, update it or remove the stale label. + Otherwise, it will be auto-closed in 7 days. + close-issue-message: > + πŸ”’ This issue was auto-closed due to inactivity for over 6 months. + close-pr-message: > + πŸ”’ This PR was auto-closed due to inactivity for over 6 months. + stale-issue-label: '⚰️ Stale' + close-issue-label: 'πŸ•ΈοΈ Inactive' + stale-pr-label: '⚰️ Stale' + close-pr-label: 'πŸ•ΈοΈ Inactive' + exempt-issue-labels: 'πŸ“Œ Keep Open' + exempt-pr-labels: 'πŸ“Œ Keep Open' + + await-user-response: + name: Mark Issues/PRs Awaiting User Response + runs-on: ubuntu-latest + needs: mark-inactivity + + steps: + - name: Mark Issues/PRs Awaiting User Response + # Close Stale Issues and PRs + # https://github.com/marketplace/actions/close-stale-issues + uses: actions/stale@v9 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + days-before-stale: 7 + days-before-close: 7 + operations-per-run: 30 + remove-stale-when-updated: true + stale-issue-message: > + ⚠️ Hey! We need some more info to move forward with this issue. + Please provide the requested details in the next few days to keep this ticket open. + close-issue-message: > + πŸ”’ This issue was auto-closed due to no response from user. + only-labels: '🚏 Awaiting User Response' + labels-to-remove-when-unstale: '🚏 Awaiting User Response' + stale-issue-label: 'πŸ›‘ No Response' + close-issue-label: 'πŸ•ΈοΈ Inactive' + exempt-issue-labels: '🚧 Alternative Exists' + + alternative-exists: + name: Mark Issues with Alternative Exists + runs-on: ubuntu-latest + needs: await-user-response + + steps: + - name: Mark Issues with Alternative Exists + # Close Stale Issues and PRs + # https://github.com/marketplace/actions/close-stale-issues + uses: actions/stale@v9 + with: + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + days-before-stale: 7 + days-before-close: 7 + operations-per-run: 30 + remove-stale-when-updated: true + stale-issue-message: > + πŸ”„ An alternative solution has been provided for this issue. + Did this solve your problem? If so, we'll go ahead and close it. + If you still need help, drop a comment within the next 7 days to keep this open. + close-issue-message: > + βœ… Closing this issue due to no confirmation on the alternative solution. + only-labels: '🚧 Alternative Exists' + stale-issue-label: '🚏 Awaiting User Response' + close-issue-label: 'πŸ•ΈοΈ Inactive' + exempt-issue-labels: 'πŸ“Œ Keep Open' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index 554c588b8..000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: "Issue Labeler" -on: - issues: - types: [opened, edited] - -permissions: - issues: write - contents: read - -jobs: - triage: - runs-on: ubuntu-latest - steps: - - uses: github/issue-labeler@v3.4 - with: - configuration-path: .github/labeler.yml -# not-before: 2020-01-15T02:54:32Z # optional and will result in any issues prior to this timestamp to be ignored. - enable-versioned-regex: 0 - repo-token: ${{ github.token }} \ No newline at end of file diff --git a/.github/workflows/manage-pending-labels-closed.yml b/.github/workflows/manage-pending-labels-closed.yml deleted file mode 100644 index 892f2f8f9..000000000 --- a/.github/workflows/manage-pending-labels-closed.yml +++ /dev/null @@ -1,17 +0,0 @@ -# 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 - -name: 🎯 Remove Pending Labels on Close -on: - issues: - types: [closed] -jobs: - remove-labels: - runs-on: ubuntu-latest - steps: - - name: Remove Labels when Closed - uses: actions-cool/issues-helper@v2 - with: - actions: remove-labels - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: '🚏 Awaiting User Response,⚰️ Stale,πŸ‘€ Awaiting Maintainer Response' \ No newline at end of file diff --git a/.github/workflows/manage-pending-labels.yml b/.github/workflows/manage-pending-labels.yml deleted file mode 100644 index 44d91b523..000000000 --- a/.github/workflows/manage-pending-labels.yml +++ /dev/null @@ -1,42 +0,0 @@ -# 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 - -name: 🎯 Add/ Remove Awaiting Response Labels -on: - issue_comment: - types: [created] -jobs: - remove-stale: - runs-on: ubuntu-latest - if: ${{ github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' }} - steps: - - name: Remove Stale labels when Updated - uses: actions-cool/issues-helper@v2 - with: - actions: remove-labels - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: '🚏 Awaiting User Response,⚰️ Stale' - - add-awaiting-author: - runs-on: ubuntu-latest - if: ${{!github.event.issue.pull_request && github.event.comment.author_association != 'COLLABORATOR' && github.event.comment.author_association != 'OWNER' && github.event.issue.state == 'open' }} - steps: - - name: Add Awaiting Author labels when Updated - uses: actions-cool/issues-helper@v2 - with: - actions: add-labels - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: 'πŸ‘€ Awaiting Maintainer Response' - - remove-awaiting-author: - runs-on: ubuntu-latest - if: ${{ github.event.comment.author_association == 'OWNER' }} - steps: - - name: Remove Awaiting Author labels when Updated - uses: actions-cool/issues-helper@v2 - with: - actions: remove-labels - token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: 'πŸ‘€ Awaiting Maintainer Response' \ No newline at end of file diff --git a/.github/workflows/on-close-handler.yml b/.github/workflows/on-close-handler.yml new file mode 100644 index 000000000..39da98688 --- /dev/null +++ b/.github/workflows/on-close-handler.yml @@ -0,0 +1,23 @@ +name: 🎯 Issues/PRs On Close Handler + +on: + issues: + types: [closed] + pull_request_target: + types: [closed] + +jobs: + remove-labels: + name: Remove Pending Labels on Close + runs-on: ubuntu-latest + + steps: + - name: Remove Pending Labels on Close + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: remove-labels + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} + labels: '🚏 Awaiting User Response,πŸ§‘β€πŸ’» In Progress,πŸ“Œ Keep Open,🚫 Merge Conflicts,πŸ”¬ Needs Testing,πŸ”¨ Needs Work,⚰️ Stale,β›” Waiting For External/Upstream' diff --git a/.github/workflows/on-open-handler.yml b/.github/workflows/on-open-handler.yml new file mode 100644 index 000000000..07e781475 --- /dev/null +++ b/.github/workflows/on-open-handler.yml @@ -0,0 +1,50 @@ +name: 🎯 Issues/PRs Open Handler + +on: + issues: + types: [opened] + pull_request_target: + types: [opened] + +jobs: + label-maintainer: + name: Label if Author is a Repo Maintainer + runs-on: ubuntu-latest + + steps: + - name: Label if Author is a Repo Maintainer + # GitHub Script + # https://github.com/marketplace/actions/github-script + uses: actions/github-script@v7 + with: + script: | + // Get basic info + const { owner, repo } = context.repo; + const payload = context.payload; + // Determine if it's an issue or a pull request + const eventData = payload.issue || payload.pull_request; + const username = eventData.user.login; + const issue_number = eventData.number; + + // Get the collaborator permission level for the user + const { data: permissionData } = await github.repos.getCollaboratorPermissionLevel({ + owner, + repo, + username, + }); + + const permission = permissionData.permission; + console.log(`User ${username} has permission level: ${permission}`); + + // Check if user is an admin or has maintain permissions + if (['admin', 'maintain'].includes(permission)) { + console.log(`Adding "Maintainer" label to issue/PR #${issue_number}`); + await github.issues.addLabels({ + owner, + repo, + issue_number, + labels: ['πŸ‘· Maintainer'], + }); + } else { + console.log(`User ${username} is not a repo maintainer.`); + } diff --git a/.github/workflows/pr-auto-manager.yml b/.github/workflows/pr-auto-manager.yml new file mode 100644 index 000000000..35cfabd8c --- /dev/null +++ b/.github/workflows/pr-auto-manager.yml @@ -0,0 +1,182 @@ +name: 🎯 Pull Request Manager + +on: + pull_request_target: + types: [opened, synchronize, reopened, edited, labeled, unlabeled, closed] + pull_request_review_comment: + types: [created] + +jobs: + label-by-size: + name: Apply Label for PR Size + runs-on: ubuntu-latest + + steps: + - name: Label PR Size + # Pull Request Size Labeler + # https://github.com/marketplace/actions/pull-request-size-labeler + uses: codelytv/pr-size-labeler@v1 + with: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + xs_label: '🟩 ⬀○○○○' + xs_max_size: '20' + s_label: '🟩 ⬀⬀○○○' + s_max_size: '100' + m_label: '🟨 ⬀⬀⬀○○' + m_max_size: '500' + l_label: '🟧 ⬀⬀⬀⬀○' + l_max_size: '1000' + xl_label: 'πŸŸ₯ ⬀⬀⬀⬀⬀' + fail_if_xl: 'false' + github_api_url: 'https://api.github.com' + files_to_ignore: | + "package-lock.json" + "public/lib/*" + + label-by-branches: + name: Apply Labels Based on Branch Name and Target Branch + runs-on: ubuntu-latest + # Only label once when PR is created or branches are changed, to allow manual label removal + if: github.event.action == 'opened' || (github.event.action == 'synchronize' && (github.event.changes.base || github.event.changes.head)) + + steps: + - name: Apply Labels Based on Branch Name and Target Branch + # Pull Request Labeler + # https://github.com/marketplace/actions/labeler + uses: actions/labeler@v5 + with: + configuration-path: .github/pr-auto-labels-by-branch.yml + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + + label-by-files: + name: Apply Labels Based on Changed Files + runs-on: ubuntu-latest + + steps: + - name: Apply Labels Based on Changed Files + # Pull Request Labeler + # https://github.com/marketplace/actions/labeler + uses: actions/labeler@v5 + with: + configuration-path: .github/pr-auto-labels-by-files.yml + repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + + remove-stale-label: + name: Remove Stale Label on Comment + runs-on: ubuntu-latest + # Only runs when this is not done by the github actions bot + if: github.actor != 'github-actions[bot]' + + steps: + - name: Remove Stale Label + # πŸ€– Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 + with: + actions: 'remove-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + labels: '⚰️ Stale' + + check-merge-blocking-labels: + name: Check Merge Blocking Labels + needs: [label-by-branches, label-by-files] + runs-on: ubuntu-latest + # Run, even if the previous jobs were skipped/failed + if: always() + + steps: + - name: Check Merge Blocking + # GitHub Script + # https://github.com/marketplace/actions/github-scriptLabels + id: label-check + uses: actions/github-script@v7 + with: + script: | + const prLabels = context.payload.pull_request.labels.map(label => label.name); + const blockingLabels = [ + "β›” Don't Merge", + "πŸ”¨ Needs Work", + "πŸ”¬ Needs Testing", + "β›” Waiting For External/Upstream", + "❗ Against Release Branch", + "πŸ’₯πŸ’£ Breaking Changes" + ]; + const hasBlockingLabel = prLabels.some(label => blockingLabels.includes(label)); + + if (hasBlockingLabel) { + console.log("Blocking label detected. Setting warning status."); + await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: "PR Label Warning", + head_sha: context.payload.pull_request.head.sha, + status: "completed", + conclusion: "neutral", + output: { + title: "Potential Merge Issue", + summary: "This PR has a merge-blocking label. Proceed with caution." + } + }); + } else { + console.log("No merge-blocking labels found."); + } + + write-auto-comments: + name: Post PR Comments Based on Labels + needs: [label-by-size, label-by-branches, label-by-files] + runs-on: ubuntu-latest + # Run, even if the previous jobs were skipped/failed + if: always() + + steps: + - name: Checkout Repository + # Checkout + # https://github.com/marketplace/actions/checkout + uses: actions/checkout@v4 + + - name: Post PR Comments Based on Labels + # Label Commenter for PRs + # https://github.com/marketplace/actions/label-commenter + uses: peaceiris/actions-label-commenter@v1 + with: + config_file: .github/pr-auto-comments.yml + github_token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + + # 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. + update-linked-issues: + name: Update Issues on Staging Merge + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging' + + steps: + - name: Extract Linked Issues From PR Description + id: extract_issues + run: | + 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]') + echo "issues=$ISSUES" >> $GITHUB_ENV + + - name: Fetch Directly Linked Issues + id: fetch_linked_issues + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + REPO=${{ github.repository }} + API_URL="https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/issues" + 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]') + echo "linked_issues=$ISSUES" >> $GITHUB_ENV + + - name: Merge Issue Lists + id: merge_issues + run: | + ISSUES=$(jq -c -n --argjson a "$issues" --argjson b "$linked_issues" '$a + $b | unique') + echo "final_issues=$ISSUES" >> $GITHUB_ENV + + - name: Label Linked Issues + id: label_linked_issues + env: + GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + run: | + for ISSUE in $(echo $final_issues | jq -r '.[]'); do + echo "Updating issue #$ISSUE" + gh issue edit $ISSUE -R ${{ github.repository }} --add-label "βœ… Done (staging)" + done diff --git a/.github/workflows/pr-check-merge-conflicts.yaml b/.github/workflows/pr-check-merge-conflicts.yaml new file mode 100644 index 000000000..553ef40c9 --- /dev/null +++ b/.github/workflows/pr-check-merge-conflicts.yaml @@ -0,0 +1,24 @@ +name: 🎯 Push Handler + +on: + # So that PRs touching the same files as the push are updated + push: + # So that the `dirtyLabel` is removed if conflicts are resolved + pull_request_target: + types: [synchronize] + +jobs: + check-merge-conflicts: + name: Check Merge Conflicts + runs-on: ubuntu-latest + + steps: + - name: Check Merge Conflicts + # Label Conflicting Pull Requests + # https://github.com/marketplace/actions/label-conflicting-pull-requests + uses: eps1lon/actions-label-merge-conflict@v3 + with: + dirtyLabel: '🚫 Merge Conflicts' + repoToken: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + commentOnDirty: > + ⚠️ This PR has conflicts that need to be resolved before it can be merged.