mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 10:33:02 -05:00
Refactor: Consolidate WIP prefix logic into autofix workflow
Co-authored-by: matiss <matiss@mja.lv>
This commit is contained in:
12
.github/workflows/autofix.yml
vendored
12
.github/workflows/autofix.yml
vendored
@@ -10,11 +10,23 @@ on:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
autofix:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Comment about WIP prefix if present
|
||||
if: |
|
||||
github.event.action == 'opened' &&
|
||||
(contains(github.event.pull_request.title, '[WIP]') || startsWith(github.event.pull_request.title, 'WIP'))
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
:wave: Hi! I have added a WIP prefix to the PR. Please remove it once the PR has all CI checks passed as green and once you are happy for a maintainer to review this PR. Thanks!
|
||||
<!-- wip-prefix-comment -->
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up environment
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
40
.github/workflows/pr-wip-prefix.yml
vendored
40
.github/workflows/pr-wip-prefix.yml
vendored
@@ -1,43 +1,11 @@
|
||||
name: Add WIP prefix to PRs
|
||||
name: Disabled - Add WIP prefix to PRs (replaced by existing workflow)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
add-wip-and-comment:
|
||||
noop:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add [WIP] prefix to PR title
|
||||
id: wip
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const title = context.payload.pull_request.title || '';
|
||||
const number = context.payload.pull_request.number;
|
||||
const { owner, repo } = context.repo;
|
||||
|
||||
const hasWip = /^\s*(\[\s*WIP\s*\]|WIP\b)/i.test(title);
|
||||
let added = false;
|
||||
if (!hasWip) {
|
||||
const newTitle = `[WIP] ${title}`;
|
||||
await github.rest.pulls.update({ owner, repo, pull_number: number, title: newTitle });
|
||||
added = true;
|
||||
}
|
||||
|
||||
core.setOutput('wip_added', String(added));
|
||||
|
||||
- name: Comment why WIP prefix was added
|
||||
if: steps.wip.outputs.wip_added == 'true'
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
:wave: Hi! I have added a WIP prefix to the PR. Please remove it once the PR has all CI checks passed as green and once you are happy for a maintainer to review this PR. Thanks!
|
||||
<!-- wip-prefix-comment -->
|
||||
- run: echo "Disabled; functionality handled in existing workflow."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user