Skip to content

feat: Service Protection plugin #18690

feat: Service Protection plugin

feat: Service Protection plugin #18690

name: Handle Autogenerated Content
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if manual review has been performed
uses: actions/github-script@v7
id: labels
with:
script: |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
...context.repo,
issue_number: context.issue.number
});
return labels.map(l => l.name).includes('ci:manual-approve:generated-files')
outputs:
result: ${{ steps.labels.outputs.result }}
add-comment:
needs: [check]
if: ${{ github.event.action == 'opened' || github.event.action == 'synchronize' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Add warning if needed
run: |
cd check-generated-content
npm ci
node run.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
prevent-merge-if-labeled:
needs: [check]
if: needs.check.outputs.result == 'false'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: mheap/github-action-required-labels@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 0
labels: "ci:prevent-merge:generated-files"