-
Notifications
You must be signed in to change notification settings - Fork 16
71 lines (60 loc) · 1.83 KB
/
build.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Validate and format JSON
run: node src/lint-json.mjs
- name: Run node script to update categories
run: |
node src/categories.mjs
- name: Detect changes
uses: dorny/paths-filter@v3
id: changes
with:
base: HEAD
filters: |
all:
- '**'
categories:
- 'gitbook/categories/**'
tools:
- 'gitbook/tools/**'
- name: Commit categories
if: steps.changes.outputs.categories == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add gitbook/categories
git commit -m "Build: Update Categories"
- name: Commit tools
if: steps.changes.outputs.tools == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add gitbook/tools
git commit -m "Build: Update Tools"
- name: Push changes
if: steps.changes.outputs.all == 'true'
uses: ad-m/github-push-action@master
with:
branch: build
force: true
- name: Create Pull Request
if: steps.changes.outputs.all == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: build
commit-message: "Build: Update all"
title: "Update Build"
body: "This pull request updates the build based on latest changes."