generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 104
65 lines (56 loc) · 2.34 KB
/
extract-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
61
62
63
64
65
name: Update CLI Texts
on:
workflow_dispatch:
schedule:
# Runs every Wednesday at 02:45 AM (UTC)
- cron: '45 2 * * 3'
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
run_script_and_create_pr:
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'
- name: Extract CLI texts
run: |
npm i -g @sap/cds-dk
pushd /tmp && rm -rf your-project && cds init your-project && pushd your-project && npm i && popd && popd
.github/cli/grab-cli-texts.js @cap-js/cds-typer "cds-typer --help" /tmp/your-project > tools/assets/help/cds-typer.out.md
.github/cli/grab-cli-texts.js @sap/cds-dk "cds --help" /tmp/your-project > tools/assets/help/cds-help.out.md
.github/cli/grab-cli-texts.js @sap/cds-dk "cds watch --help" /tmp/your-project > tools/assets/help/cds-watch.out.md
.github/cli/grab-cli-texts.js @sap/cds-dk "cds version" /tmp/your-project > tools/assets/help/cds-version.out.md
.github/cli/grab-cli-texts.js @sap/cds-dk "cds version --markdown" /tmp/your-project > tools/assets/help/cds-version-md.out.md
- name: Check for changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if git diff --exit-code; then
echo "No changes detected. Exiting."
exit 0
fi
- name: Commit and push changes
id: commit_changes
run: |
BRANCH_NAME="update-cds-cli-texts-$(date +'%Y%m%d%H%M%S')"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git stash
git checkout -b "$BRANCH_NAME"
git stash pop
git add -A
git commit -m "Update CLI texts"
git status
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.commit_changes.outputs.BRANCH_NAME }}
title: "chore: Update CLI texts"
body: "Updates the output of cds CLI texts to the latest version."
base: main