3333 repository : immutable/docs
3434 token : ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
3535 path : imx-docs
36- ref : main
36+ ref : DVR-295-docs-restructure
3737
3838 - name : Setup environment variables
3939 run : |
@@ -59,21 +59,41 @@ jobs:
5959 ./.github/scripts/process-tutorials.sh
6060 shell : bash
6161
62- - name : Commit and Push Changes to Docs Repo
62+ - name : Create Pull Request in Docs Repo
63+ id : create_pr
6364 run : |
6465 cd "$CLONE_DIR"
65- # Check if there are changes to commit
66- if git status --porcelain | grep -q .; then
67- # Add all changes
68- git add .
69-
70- # Commit the changes
71- git commit -m "Update example app tutorials from SDK repo"
72-
73- # Push to the target branch
74- git push -u origin main
75- echo "Successfully pushed example app tutorial changes to docs repo"
76- else
66+ if ! git status --porcelain | grep -q .; then
7767 echo "No changes to commit"
68+ echo "pr_url=" >> $GITHUB_OUTPUT
69+ exit 0
7870 fi
79- shell : bash
71+
72+ BRANCH_NAME="chore/sdk-docs-update-${{ github.run_id }}"
73+ git checkout -b $BRANCH_NAME
74+
75+ git add .
76+ git commit -m "Update example app tutorials from SDK repo"
77+ git push -u origin $BRANCH_NAME
78+ echo "Successfully pushed changes to docs repo on branch $BRANCH_NAME"
79+
80+ PR_URL=$(gh pr create \
81+ --title "Update example app tutorials from SDK repo" \
82+ --body "Automated PR from ts-immutable-sdk to update tutorials. Review and merge if all looks good." \
83+ --base DVR-295-docs-restructure \
84+ --repo immutable/docs)
85+
86+ echo "Successfully created PR in docs repo: $PR_URL"
87+ echo "pr_url=${PR_URL}" >> $GITHUB_OUTPUT
88+ env :
89+ GITHUB_TOKEN : ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
90+ shell : bash
91+
92+ # - name: Notify Slack of New Docs PR
93+ # if: steps.create_pr.outputs.pr_url != ''
94+ # uses: slackapi/slack-github-action@v1.26.0
95+ # with:
96+ # channel-id: ${{ secrets.DOCS_PR_SLACK_CHANNEL_ID }}
97+ # slack-message: "New automated tutorials PR is ready for review: <${{ steps.create_pr.outputs.pr_url }}|View Pull Request>"
98+ # env:
99+ # SLACK_BOT_TOKEN: ${{ secrets.DOCS_PR_SLACK_BOT_TOKEN }}
0 commit comments