feat(releasing): add deprecation.d fragment system #508
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Adds a label to PRs that touch documentation paths until a maintainer approves. | |
| # Currently dedicated to the docs review flow. If a second use case appears, promote | |
| # this into a reusable workflow (`workflow_call`) with the label as an input. | |
| name: Add Docs Review Label | |
| permissions: | |
| pull-requests: write | |
| on: | |
| pull_request_target: | |
| types: [opened, reopened, synchronize] | |
| # Keep these paths in sync with the documentation team entries in .github/CODEOWNERS | |
| paths: | |
| - "*.md" | |
| - "docs/**" | |
| - "deprecation.d/**" | |
| - "website/content/**" | |
| - "website/cue/reference/**" | |
| env: | |
| LABEL_NAME: "docs review on hold" | |
| jobs: | |
| add_label: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check member review state | |
| id: check | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const { data: reviews } = await github.rest.pulls.listReviews({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number, | |
| }); | |
| const allowed = ['MEMBER', 'OWNER']; | |
| const latestByUser = new Map(); | |
| for (const r of reviews) { | |
| if (!allowed.includes(r.author_association)) continue; | |
| if (r.state === 'COMMENTED') continue; | |
| latestByUser.set(r.user.id, r.state); | |
| } | |
| const states = [...latestByUser.values()]; | |
| const hasApproved = states.includes('APPROVED'); | |
| const hasChangesRequested = states.includes('CHANGES_REQUESTED'); | |
| const skip = hasApproved && !hasChangesRequested; | |
| core.info(`Latest member review states: ${states.join(', ') || '(none)'}`); | |
| core.info(`skip=${skip}`); | |
| core.setOutput('skip', skip); | |
| - if: steps.check.outputs.skip != 'true' | |
| uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3 | |
| with: | |
| labels: ${{ env.LABEL_NAME }} |