Update ToolHive Reference Docs #155
Workflow file for this run
This file contains hidden or 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 ToolHive Reference Docs | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'ToolHive version to update reference docs for' | |
| required: true | |
| default: 'latest' | |
| assign_to: | |
| description: 'GitHub username to assign the PR to (optional)' | |
| required: false | |
| repository_dispatch: | |
| types: [published-release] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: update-toolhive-reference | |
| cancel-in-progress: false | |
| jobs: | |
| update-reference: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Determine version | |
| id: get-version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then | |
| echo "version=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Determine assignee | |
| id: get-assignee | |
| run: | | |
| if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then | |
| ASSIGNEE="${{ github.event.client_payload.assign_to }}" | |
| else | |
| ASSIGNEE="${{ github.event.inputs.assign_to }}" | |
| fi | |
| # Filter out github-actions bot (can't be assigned to PRs) | |
| if [[ "$ASSIGNEE" =~ ^github-actions ]]; then | |
| ASSIGNEE="" | |
| fi | |
| echo "assign_to=$ASSIGNEE" >> $GITHUB_OUTPUT | |
| - name: Run update script | |
| id: imports | |
| run: | | |
| chmod +x scripts/update-toolhive-reference.sh | |
| if ! scripts/update-toolhive-reference.sh ${{ steps.get-version.outputs.version }}; then | |
| echo "::error::Failed to update ToolHive reference docs" | |
| exit 1 | |
| fi | |
| - name: Check for changes | |
| id: git-diff | |
| run: | | |
| git add . | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected." | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Pull Request | |
| if: steps.git-diff.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8 | |
| with: | |
| branch: update-toolhive-reference-${{ steps.imports.outputs.version }} | |
| title: | | |
| Update ToolHive reference docs for ${{ steps.imports.outputs.version }} | |
| body: | | |
| This PR updates the ToolHive CLI and API reference documentation for release: ${{ steps.imports.outputs.version }}. | |
| commit-message: | | |
| Update ToolHive reference docs for ${{ steps.imports.outputs.version }} | |
| labels: | | |
| autogen-docs | |
| assignees: ${{ steps.get-assignee.outputs.assign_to }} | |
| delete-branch: true | |
| sign-commits: true |