Skip to content

Update CLI reference #10

Update CLI reference

Update CLI reference #10

on:
workflow_dispatch
name: Update CLI reference
jobs:
update-cli-reference:
name: Update the CLI reference
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: checkout
uses: actions/checkout@v3
- name: Download and prepare the am binary
run: |
curl -L https://github.com/autometrics-dev/am/releases/latest/download/am-linux-x86_64 -o $RUNNER_TEMP/am
chmod u+x $RUNNER_TEMP/am
- name: Generate the CLI reference
run: |
$RUNNER_TEMP/am markdown-help > src/pages/local-development/cli-reference.md
echo "am_version=$($RUNNER_TEMP/am --version | awk '{print $2}')" >> "$GITHUB_ENV"
- name: Create a branch and add the changed commit
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
echo "branch_name=bot-cli-reference-$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
git add src/pages/local-development/cli-reference.md
git commit -m "Automated CLI reference update for ${{ env.am_version }} - $(date +'%Y-%m-%d')"
- name: Create a PR with changes
uses: peter-evans/create-pull-request@v5
with:
base: main
commit-message: Automated CLI reference update
branch: ${{ env.branch_name }}
delete-branch: true
title: "[bot] Update Autometrics CLI reference: `${{ env.am_version }}`"
body: |
This is an automated PR that automatically regenerates and updates the CLI reference.
labels: |
bot