Skip to content

Commit 6818b9c

Browse files
prontclaude
andauthored
feat(ci): add work-in-progress label workflow for docs PRs (#24950)
* feat(ci): add workflow to manage work-in-progress label on PRs Automatically adds a "work in progress" label when a PR is opened or reopened, and removes it when a member or owner approves the PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(ci): replace work-in-progress with under_review label for docs PRs Target only PRs that touch docs-owned paths (matching CODEOWNERS) so the docs team isn't pinged until a Vector team member approves. The label is auto-added on open/reopen and auto-removed on first member approval. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(ci): fix prettier formatting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(ci): use work-in-progress label instead of under_review Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(ci): split wip label into add/remove workflows with tested approach - Split single workflow into add_wip_label.yml and remove_wip_label.yml to avoid paths filter affecting pull_request_review events - Move association and label checks into github-script step instead of job if condition (GitHub Actions silently fails author_association checks in if expressions) - Tested end-to-end in vectordotdev/ci-sandbox Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(ci): trigger WIP label on synchronize to catch docs paths added later Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dac7c31 commit 6818b9c

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.github/workflows/regression.yml @vectordotdev/vector @vectordotdev/single-machine-performance
44
regression/config.yaml @vectordotdev/vector @vectordotdev/single-machine-performance
55

6+
# Keep documentation team paths in sync with .github/workflows/add_wip_label.yml
67
docs/ @vectordotdev/vector @vectordotdev/documentation
78
website/ @vectordotdev/vector
89
website/content @vectordotdev/vector @vectordotdev/documentation
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Add Work In Progress Label
2+
3+
permissions:
4+
pull-requests: write
5+
6+
on:
7+
pull_request_target:
8+
types: [opened, reopened, synchronize]
9+
# Keep these paths in sync with the documentation team entries in .github/CODEOWNERS
10+
paths:
11+
- "docs/**"
12+
- "website/content/**"
13+
- "website/cue/reference/**"
14+
15+
jobs:
16+
add_wip_label:
17+
runs-on: ubuntu-24.04
18+
timeout-minutes: 5
19+
steps:
20+
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
21+
with:
22+
labels: "work in progress"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Remove Work In Progress Label
2+
3+
permissions:
4+
pull-requests: write
5+
6+
on:
7+
pull_request_review:
8+
types: [submitted]
9+
10+
jobs:
11+
remove_wip_label:
12+
if: github.event.review.state == 'approved'
13+
runs-on: ubuntu-24.04
14+
timeout-minutes: 5
15+
steps:
16+
- name: Check association, label, and remove
17+
uses: actions/github-script@v7
18+
with:
19+
script: |
20+
const association = context.payload.review.author_association;
21+
core.info(`Author association: ${association}`);
22+
23+
const allowed = ['MEMBER', 'OWNER'];
24+
if (!allowed.includes(association)) {
25+
core.info(`Association "${association}" not in allowed list, skipping`);
26+
return;
27+
}
28+
29+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
issue_number: context.payload.pull_request.number,
33+
});
34+
const hasLabel = labels.some(l => l.name === 'work in progress');
35+
if (!hasLabel) {
36+
core.info('Label "work in progress" not found, skipping');
37+
return;
38+
}
39+
await github.rest.issues.removeLabel({
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
issue_number: context.payload.pull_request.number,
43+
name: 'work in progress',
44+
});
45+
core.info('Removed "work in progress" label');

0 commit comments

Comments
 (0)