Reorganize workflow files and names into 3 main categories: - Data: Data collection and synchronization workflows - Infrastructure: Infrastructure tasks (mirroring, forking) - Maintenance: All PR checks, labels, notifications, and maintenance tasks All workflows now have capitalized category prefixes for consistency. Also update internal workflow references to reflect new names.
55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
name: "Maintenance: Label PR on approval"
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Maintenance: Listen PR review"]
|
|
types: [completed]
|
|
|
|
jobs:
|
|
label:
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Download PR number artifact from upstream run
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: pr-number-${{ github.event.workflow_run.id }} # same unique name
|
|
path: .
|
|
run-id: ${{ github.event.workflow_run.id }} # ← CRITICAL: fetch from the upstream run
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- id: pr
|
|
run: echo "number=$(cat pr.txt)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Label when approved
|
|
uses: j-fulbright/label-when-approved-action@v1.2
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
label: 'Ready to merge'
|
|
require_committers_approval: 'true'
|
|
remove_label_when_approval_missing: 'true'
|
|
comment: '✅ This PR has been reviewed and approved — all set for merge!'
|
|
pullRequestNumber: ${{ steps.pr.outputs.number }}
|
|
|
|
- name: Remove review-related labels
|
|
if: ${{ success() }}
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
const { owner, repo } = context.repo;
|
|
const issue_number = ${{ steps.pr.outputs.number }};
|
|
const labelsToRemove = ["Needs review", "Work in progress", "Backlog", "Can be closed?", "Help needed", "Needs Documentation"];
|
|
|
|
for (const name of labelsToRemove) {
|
|
try {
|
|
await github.rest.issues.removeLabel({ owner, repo, issue_number, name });
|
|
core.info(`Removed label "${name}"`);
|
|
} catch (e) {
|
|
core.warning(`Could not remove label "${name}": ${e.message}`);
|
|
}
|
|
}
|