|
| 1 | +name: Update ToolHive Reference Docs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: write |
| 8 | + pull-requests: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + update-reference: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Set up Git |
| 20 | + run: | |
| 21 | + git config --global user.name "github-actions[bot]" |
| 22 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 23 | +
|
| 24 | + - name: Run update-toolhive-reference.sh and capture version |
| 25 | + id: imports |
| 26 | + run: | |
| 27 | + chmod +x scripts/update-toolhive-reference.sh |
| 28 | + scripts/update-toolhive-reference.sh |
| 29 | +
|
| 30 | + - name: Check for changes |
| 31 | + id: git-diff |
| 32 | + run: | |
| 33 | + git add . |
| 34 | + if git diff --cached --quiet; then |
| 35 | + echo "No changes to commit." |
| 36 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 37 | + else |
| 38 | + echo "Changes detected." |
| 39 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 40 | + fi |
| 41 | +
|
| 42 | + - name: Create branch, commit, and push |
| 43 | + if: steps.git-diff.outputs.changed == 'true' |
| 44 | + run: | |
| 45 | + BRANCH=update-toolhive-reference-${VERSION} |
| 46 | + git checkout -b "$BRANCH" |
| 47 | + git commit -am "Update ToolHive reference docs for ${VERSION}" |
| 48 | + git push origin "$BRANCH" |
| 49 | + env: |
| 50 | + VERSION: ${{ steps.imports.outputs.version }} |
| 51 | + |
| 52 | + - name: Create Pull Request |
| 53 | + if: steps.git-diff.outputs.changed == 'true' |
| 54 | + uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6 |
| 55 | + with: |
| 56 | + branch: update-toolhive-reference-${{ steps.imports.outputs.version }} |
| 57 | + title: | |
| 58 | + Update ToolHive reference docs for ${{ steps.imports.outputs.version }} |
| 59 | + body: | |
| 60 | + This PR updates the ToolHive CLI and API reference documentation to the latest release: ${{ steps.imports.outputs.version }}. |
| 61 | + commit-message: | |
| 62 | + Update ToolHive reference docs for ${{ steps.imports.outputs.version }} |
| 63 | + delete-branch: true |
0 commit comments