1 # This file is automatically added by @npmcli/template-oss. Do not edit.
2
3 name: Update CLI
4
5 on:
6 workflow_dispatch:
7 schedule:
8 - cron: "14 2 * * *"
9
10 jobs:
11 update-cli:
12 outputs:
13 has_changes: ${{ steps.status.outputs.has_changes }}
14 permissions:
15 contents: write
16 name: Update CLI
17 if: github.repository_owner == 'npm'
18 runs-on: ubuntu-latest
19 defaults:
20 run:
21 shell: bash
22 steps:
23 - name: Checkout
24 uses: actions/checkout@v6
25 - name: Setup Git User
26 run: |
27 git config --global user.email "npm-cli+bot@github.com"
28 git config --global user.name "npm CLI robot"
29 - name: Setup Node
30 uses: actions/setup-node@v6
31 id: node
32 with:
33 node-version: 22.x
34 check-latest: contains('22.x', '.x')
35 cache: npm
36 - name: Install Dependencies
37 run: npm i --no-audit --no-fund
38 - name: Build documentation
39 run: npm run build -w cli
40 env:
41 # token is used to get files from `npm/cli` that
42 # are not present in the published tarball
43 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 - name: Check for changes
45 id: status
46 run: |
47 if [ -n "$(git status --porcelain)" ]; then
48 echo "has_changes=1" >> "$GITHUB_OUTPUT"
49 fi
50 - name: Check in source updates
51 if: steps.status.outputs.has_changes == '1'
52 run: |
53 git add --verbose .
54 git commit -m 'CLI documentation update from CI'
55 git push origin main
56
57 publish:
58 needs: update-cli
59 if: needs.update-cli.outputs.has_changes == '1'
60 permissions:
61 contents: read
62 pages: write
63 id-token: write
64 actions: read
65 uses: ./.github/workflows/publish.yml