-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathcheck-for-duplicate-page-ids.yml
More file actions
49 lines (39 loc) · 1.32 KB
/
check-for-duplicate-page-ids.yml
File metadata and controls
49 lines (39 loc) · 1.32 KB
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: Check for Duplicate Page IDs
on:
pull_request:
# Automatically cancel in-progress actions on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
check-duplicates:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- name: Install dependencies
run: npm install
- name: Run duplicate check script
id: check_duplicates
run: |
set -o pipefail
node ./scripts/check-for-duplicate-page-ids.js 2>&1 | tee check-duplicates.log
- name: Annotate PR on error
if: failure()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const log = fs.readFileSync('check-duplicates.log', 'utf8');
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: `## ❌ Duplicate page_id(s) found:\n\`\`\`\n${log}\n\`\`\``,
});
- name: Fail the job if duplicates are found
if: failure()
run: exit 1