1111 required : false
1212 default : " "
1313 pull_request :
14+ paths :
15+ - ' .github/workflows/sync-cli-docs.yml'
16+ - ' hack/sync-cli-docs.sh'
1417
1518permissions :
1619 contents : write
4952 ref : ${{ steps.get-version.outputs.version }}
5053 fetch-depth : 0
5154 -
52- name : Create update branch
53- id : create-branch
55+ name : Git config
5456 run : |
55- BRANCH_NAME="bot/sync-cli-docs-$(date +%Y%m%d-%H%M%S)"
56- git checkout -b "$BRANCH_NAME"
57- echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
5857 git config user.name "github-actions[bot]"
5958 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6059 -
@@ -65,36 +64,45 @@ jobs:
6564 ./hack/sync-cli-docs.sh HEAD cli-source
6665 EXIT_CODE=$?
6766 set -e
68-
67+
6968 if [ $EXIT_CODE -eq 0 ]; then
70- echo "changes=true" >> "$GITHUB_OUTPUT"
7169 echo "Changes detected - syncing CLI docs" >> "$GITHUB_STEP_SUMMARY"
7270 elif [ $EXIT_CODE -eq 100 ]; then
73- echo "changes=false" >> "$GITHUB_OUTPUT"
7471 echo "No changes to sync - CLI docs are up to date" >> "$GITHUB_STEP_SUMMARY"
7572 else
7673 echo "::error::Script failed with exit code $EXIT_CODE"
7774 exit $EXIT_CODE
7875 fi
79-
8076 -
81- name : Show PR
82- if : steps.sync.outputs.changes == 'true'
77+ name : Clean up temporary directories
78+ if : always()
8379 run : |
84- git show "${{ steps.create-branch.outputs.branch_name }}"
80+ # Remove the worktree
81+ if [ -d "internal-update-cli-docs" ]; then
82+ GIT_DIR="cli-source/.git" git worktree remove internal-update-cli-docs --force || true
83+ fi
84+ # Remove the cli source directory
85+ rm -rf cli-source
8586 -
8687 name : Create Pull Request
87- if : steps.sync.outputs.changes == 'true' && github.event_name != 'pull_request'
88- env :
89- GH_TOKEN : ${{ github.token }}
90- PR_BODY : |
88+ id : cpr
89+ uses : peter-evans/create-pull-request@v7
90+ with :
91+ token : ${{ secrets.GITHUB_TOKEN }}
92+ branch : bot/sync-cli-docs-${{ steps.get-version.outputs.version }}
93+ base : main
94+ delete-branch : true
95+ title : " cli: sync docs with docker/cli"
96+ body : |
9197 ## Summary
9298
9399 Automated sync of CLI documentation from docker/cli repository.
100+
101+ **CLI version**: ${{ steps.get-version.outputs.version }}
102+ reviewers : " @engine"
103+ -
104+ name : Check outputs
105+ if : ${{ steps.cpr.outputs.pull-request-number }}
94106 run : |
95- git push -u origin "${{ steps.create-branch.outputs.branch_name }}"
96- gh pr create \
97- --title "cli: sync docs with docker/cli" \
98- --body "$PR_BODY" \
99- --base main \
100- --head "${{ steps.create-branch.outputs.branch_name }}"
107+ echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
108+ echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
0 commit comments