mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Extract workflows for merge conflicts + issue done
- Extract merge conflicts check to its own workflow, plus make it run on push - Add issues update as Done or Done staging based on extracted commit messages
This commit is contained in:
39
.github/workflows/issues-updates-on-merge.yml
vendored
Normal file
39
.github/workflows/issues-updates-on-merge.yml
vendored
Normal 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
|
27
.github/workflows/pr-auto-manager.yml
vendored
27
.github/workflows/pr-auto-manager.yml
vendored
@@ -7,21 +7,6 @@ on:
|
||||
types: [created]
|
||||
|
||||
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.
|
||||
|
||||
label-by-size:
|
||||
name: Apply Label for PR Size
|
||||
runs-on: ubuntu-latest
|
||||
@@ -95,8 +80,10 @@ jobs:
|
||||
|
||||
check-merge-blocking-labels:
|
||||
name: Check Merge Blocking Labels
|
||||
needs: [check-merge-conflicts, label-by-branches]
|
||||
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
|
||||
@@ -108,7 +95,6 @@ jobs:
|
||||
script: |
|
||||
const prLabels = context.payload.pull_request.labels.map(label => label.name);
|
||||
const blockingLabels = [
|
||||
"🚫 Merge Conflicts",
|
||||
"⛔ Don't Merge",
|
||||
"🔨 Needs Work",
|
||||
"🔬 Needs Testing",
|
||||
@@ -138,8 +124,10 @@ jobs:
|
||||
|
||||
write-auto-comments:
|
||||
name: Post PR Comments Based on Labels
|
||||
needs: [check-merge-conflicts, label-by-size, label-by-branches, label-by-files, remove-stale-label]
|
||||
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
|
||||
@@ -155,13 +143,14 @@ jobs:
|
||||
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
|
||||
- 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]')
|
||||
|
24
.github/workflows/pr-check-merge-conflicts.yaml
vendored
Normal file
24
.github/workflows/pr-check-merge-conflicts.yaml
vendored
Normal 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.
|
Reference in New Issue
Block a user