@@ -526,26 +526,52 @@ jobs:
526526 permissions :
527527 contents : read
528528 steps :
529+ - name : Check if CLI docs changed
530+ id : check-docs
531+ env :
532+ GH_TOKEN : ${{ secrets.CLI_RELEASE_PAT }}
533+ RELEASE_TAG : ${{ needs.prepare.outputs.release_tag }}
534+ PREVIOUS_TAG : ${{ needs.prepare.outputs.previous_tag }}
535+ run : |
536+ if [ -z "$PREVIOUS_TAG" ]; then
537+ echo "No previous tag — assuming docs changed"
538+ echo "changed=true" >> "$GITHUB_OUTPUT"
539+ exit 0
540+ fi
541+ CHANGED=$(gh api repos/docker/model-runner/compare/${PREVIOUS_TAG}...${RELEASE_TAG} \
542+ --jq '[.files[].filename | select(startswith("cmd/cli/docs/reference/"))] | length')
543+ if [ "$CHANGED" -gt 0 ]; then
544+ echo "CLI docs changed ($CHANGED files)"
545+ echo "changed=true" >> "$GITHUB_OUTPUT"
546+ else
547+ echo "No CLI docs changes between $PREVIOUS_TAG and $RELEASE_TAG — skipping"
548+ echo "changed=false" >> "$GITHUB_OUTPUT"
549+ fi
550+
529551 - name : Checkout docs
552+ if : steps.check-docs.outputs.changed == 'true'
530553 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
531554 with :
532555 repository : docker/docs
533556 token : ${{ secrets.CLI_RELEASE_PAT }}
534557 fetch-depth : 0
535558
536559 - name : Set up Go
560+ if : steps.check-docs.outputs.changed == 'true'
537561 uses : actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417
538562 with :
539563 go-version : 1.25.8
540564 cache : true
541565
542566 - name : Vendor model-runner CLI docs
567+ if : steps.check-docs.outputs.changed == 'true'
543568 env :
544569 RELEASE_TAG : ${{ needs.prepare.outputs.release_tag }}
545570 run : |
546571 VENDOR_MODULE=github.com/docker/model-runner@${RELEASE_TAG} make vendor
547572
548573 - name : Create pull request
574+ if : steps.check-docs.outputs.changed == 'true'
549575 uses : peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
550576 with :
551577 token : ${{ secrets.DOCKER_DOCS }}
0 commit comments