@@ -526,26 +526,51 @@ jobs:
526526 permissions :
527527 contents : read
528528 steps :
529+ - name : Check if CLI docs changed
530+ id : check-docs
531+ env :
532+ RELEASE_TAG : ${{ needs.prepare.outputs.release_tag }}
533+ PREVIOUS_TAG : ${{ needs.prepare.outputs.previous_tag }}
534+ run : |
535+ if [ -z "$PREVIOUS_TAG" ]; then
536+ echo "No previous tag — assuming docs changed"
537+ echo "changed=true" >> "$GITHUB_OUTPUT"
538+ exit 0
539+ fi
540+ CHANGED=$(gh api repos/docker/model-runner/compare/${PREVIOUS_TAG}...${RELEASE_TAG} \
541+ --jq '[.files[].filename | select(startswith("cmd/cli/docs/reference/"))] | length')
542+ if [ "$CHANGED" -gt 0 ]; then
543+ echo "CLI docs changed ($CHANGED files)"
544+ echo "changed=true" >> "$GITHUB_OUTPUT"
545+ else
546+ echo "No CLI docs changes between $PREVIOUS_TAG and $RELEASE_TAG — skipping"
547+ echo "changed=false" >> "$GITHUB_OUTPUT"
548+ fi
549+
529550 - name : Checkout docs
551+ if : steps.check-docs.outputs.changed == 'true'
530552 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
531553 with :
532554 repository : docker/docs
533555 token : ${{ secrets.CLI_RELEASE_PAT }}
534556 fetch-depth : 0
535557
536558 - name : Set up Go
559+ if : steps.check-docs.outputs.changed == 'true'
537560 uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
538561 with :
539562 go-version : 1.25.8
540563 cache : true
541564
542565 - name : Vendor model-runner CLI docs
566+ if : steps.check-docs.outputs.changed == 'true'
543567 env :
544568 RELEASE_TAG : ${{ needs.prepare.outputs.release_tag }}
545569 run : |
546570 VENDOR_MODULE=github.com/docker/model-runner@${RELEASE_TAG} make vendor
547571
548572 - name : Create pull request
573+ if : steps.check-docs.outputs.changed == 'true'
549574 uses : peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
550575 with :
551576 token : ${{ secrets.DOCKER_DOCS }}
0 commit comments