Merge pull request #3678 from SillyTavern/update-git-workflows

Update github workflows for better issue & PR management, automating chores
This commit is contained in:
Wolfsblvt
2025-03-13 22:14:56 +01:00
committed by GitHub
23 changed files with 773 additions and 314 deletions

View File

@@ -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] <title>'
labels: ['🐛 Bug']

View File

@@ -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

View File

@@ -1,2 +0,0 @@
🐛 Bug: ✅ Fixed
🦄 Feature Request: ✅ Implemented

View File

@@ -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.

69
.github/issues-auto-comments.yml vendored Normal file
View File

@@ -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.

View File

@@ -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)'
- '(🐧 Linux)'
🦊 Firefox:
- '(firefox|mozilla)'
📱 Mobile:
- '(iphone|ios|android|📱 Termux)'

51
.github/pr-auto-comments.yml vendored Normal file
View File

@@ -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.

77
.github/pr-auto-labels-by-branch.yml vendored Normal file
View File

@@ -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']

46
.github/pr-auto-labels-by-files.yml vendored Normal file
View File

@@ -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"

View File

@@ -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 }}

View File

@@ -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

View File

@@ -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'

View File

@@ -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.

View File

@@ -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 }}

View File

@@ -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

95
.github/workflows/job-close-stale.yml vendored Normal file
View File

@@ -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'

View File

@@ -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 }}

View File

@@ -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'

View File

@@ -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'

23
.github/workflows/on-close-handler.yml vendored Normal file
View File

@@ -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'

50
.github/workflows/on-open-handler.yml vendored Normal file
View File

@@ -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.`);
}

182
.github/workflows/pr-auto-manager.yml vendored Normal file
View File

@@ -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

View File

@@ -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.