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
4851 path : cli-source
4952 ref : ${{ steps.get-version.outputs.version }}
5053 fetch-depth : 0
51- -
52- name : Create update branch
53- id : create-branch
54- 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"
58- git config user.name "github-actions[bot]"
59- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6054 -
6155 name : Run sync script
6256 id : sync
@@ -67,34 +61,33 @@ jobs:
6761 set -e
6862
6963 if [ $EXIT_CODE -eq 0 ]; then
70- echo "changes=true" >> "$GITHUB_OUTPUT"
7164 echo "Changes detected - syncing CLI docs" >> "$GITHUB_STEP_SUMMARY"
7265 elif [ $EXIT_CODE -eq 100 ]; then
73- echo "changes=false" >> "$GITHUB_OUTPUT"
7466 echo "No changes to sync - CLI docs are up to date" >> "$GITHUB_STEP_SUMMARY"
7567 else
7668 echo "::error::Script failed with exit code $EXIT_CODE"
7769 exit $EXIT_CODE
7870 fi
7971
80- -
81- name : Show PR
82- if : steps.sync.outputs.changes == 'true'
83- run : |
84- git show "${{ steps.create-branch.outputs.branch_name }}"
8572 -
8673 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 : |
74+ id : cpr
75+ uses : peter-evans/create-pull-request@v7
76+ with :
77+ token : ${{ secrets.GITHUB_TOKEN }}
78+ branch : bot/sync-cli-docs-${{ steps.get-version.outputs.version }}
79+ delete-branch : true
80+ title : " cli: sync docs with docker/cli"
81+ body : |
9182 ## Summary
9283
9384 Automated sync of CLI documentation from docker/cli repository.
85+
86+ **CLI version**: ${{ steps.get-version.outputs.version }}
87+
88+ -
89+ name : Check outputs
90+ if : ${{ steps.cpr.outputs.pull-request-number }}
9491 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 }}"
92+ echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
93+ echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
0 commit comments