-
Notifications
You must be signed in to change notification settings - Fork 604
49 lines (48 loc) · 1.42 KB
/
autogenerated-warning.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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"