Update CLI Texts #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update CLI Help Texts | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs every Wednesday at 02:45 AM (UTC) | |
- cron: '45 2 * * 3' | |
permissions: | |
contents: 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 (help) texts | |
run: | | |
pushd /tmp && rm -rf your-project && npm exec --package=@sap/cds-dk -c 'cds init your-project' && pushd your-project && npm i && popd && popd | |
.github/cli/grab-cli-out.js @cap-js/cds-typer "cds-typer --help" /tmp/your-project > tools/assets/help/cds-typer.out.md | |
.github/cli/grab-cli-out.js @sap/cds-dk "cds --help" /tmp/your-project > tools/assets/help/cds-help.out.md | |
.github/cli/grab-cli-out.js @sap/cds-dk "cds watch --help" /tmp/your-project > tools/assets/help/cds-watch.out.md | |
.github/cli/grab-cli-out.js @sap/cds-dk "cds version" /tmp/your-project > tools/assets/help/cds-version.out.md | |
.github/cli/grab-cli-out.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' | |
git add -A | |
if git diff --cached --exit-code; then | |
echo "No changes detected. Exiting." | |
exit 0 | |
fi | |
- name: Commit changes | |
run: | | |
git commit -m "Update cds-typer synopsis" | |
- name: Push changes | |
run: | | |
BRANCH_NAME="update-cds-typer-synopsis-$(date +'%Y%m%d%H%M%S')" | |
git checkout -b "$BRANCH_NAME" | |
git push origin "$BRANCH_NAME" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ steps.push_changes.outputs.BRANCH_NAME }} | |
title: "chore: Update synopsis for cds-typer" | |
body: "Updates the output of `cds-typer --help` to the latest version." | |
base: main |