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 name: Update CLI
15 if: github.repository_owner == 'npm'
16 runs-on: ubuntu-latest
17 defaults:
18 run:
19 shell: bash
20 steps:
21 - name: Checkout
22 uses: actions/checkout@v4
23 - name: Setup Git User
24 run: |
25 git config --global user.email "npm-cli+bot@github.com"
26 git config --global user.name "npm CLI robot"
27 - name: Setup Node
28 uses: actions/setup-node@v4
29 id: node
30 with:
31 node-version: 22.x
32 check-latest: contains('22.x', '.x')
33 cache: npm
34 - name: Install Latest npm
35 uses: ./.github/actions/install-latest-npm
36 with:
37 node: ${{ steps.node.outputs.node-version }}
38 - name: Install Dependencies
39 run: npm i --no-audit --no-fund
40 - name: Build documentation
41 run: npm run build -w cli
42 env:
43 # token is used to get files from `npm/cli` that
44 # are not present in the published tarball
45 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 - name: Check for changes
47 id: status
48 run: |
49 if [ -n "$(git status --porcelain)" ]; then
50 echo "::set-output name=has_changes::1"
51 fi
52 - name: Check in source updates
53 if: steps.status.outputs.has_changes == '1'
54 run: |
55 git add --verbose .
56 git commit -m 'CLI documentation update from CI'
57 git push origin main
58
59 publish:
60 needs: update-cli
61 if: needs.update-cli.outputs.has_changes == '1'
62 uses: ./.github/workflows/publish.yml