60 lines (57 loc) · 1.87 KB
/
update-docs.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
name: Build Docs
on:
push:
branches:
- main
paths:
- "packages/cspell-types/**/*.ts"
workflow_dispatch:
permissions:
contents: read
jobs:
update-dependencies:
if: github.repository_owner == 'streetsidesoftware'
runs-on: ubuntu-latest
env:
NEW_BRANCH: "update-docs"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3.2.0
with:
cache: npm
- name: Setup NPM
run: npm i -g npm@8
- name: Install
run: npm install
- name: Build Docs
run: |
npm run build-cspell-types-docs
- name: Has changes
run: |
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV
git --no-pager diff --compact-summary
- name: Gen Body
run: |
echo 'git_body<<DIFF' >> $GITHUB_ENV
git --no-pager diff --compact-summary >> $GITHUB_ENV
echo 'DIFF' >> $GITHUB_ENV
- name: Echo git_status
run: echo ${{ env.git_status }}
- uses: tibdex/github-app-token@7ce9ffdcdeb2ba82b01b51d6584a6a85872336d4 # v1.5 # cspell:ignore tibdex
if: env.git_status == 'dirty'
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Create Pull Request
if: env.git_status == 'dirty'
uses: peter-evans/create-pull-request@f094b77505fb89581e68a1163fbd2fffece39da1 # v4
with:
commit-message: "ci: Workflow Bot -- Build Docs"
branch: ${{ env.NEW_BRANCH }}
title: "ci: Workflow Bot -- Build Docs"
token: ${{ steps.generate-token.outputs.token }}
body: ${{ env.git_body }}
delete-branch: true