Skip to content

Commit 5234164

Browse files
fix: updated ci/cd pipeline to make a new PR instead of pushing to main
1 parent c0abbd6 commit 5234164

2 files changed

Lines changed: 36 additions & 16 deletions

File tree

.github/scripts/process-tutorials.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ for PRODUCT in "${PRODUCTS[@]}"; do
1717
echo "Processing tutorials for $PRODUCT..."
1818

1919
# Create _tutorials directory in docs repo if it doesn't exist
20-
TUTORIALS_DIR="$DOCS_REPO_DIR/docs/main/example/zkEVM/$PRODUCT-examples/_tutorials"
20+
TUTORIALS_DIR="$DOCS_REPO_DIR/docs/main/build/typescript/usage-guides/$PRODUCT"
2121
mkdir -p "$TUTORIALS_DIR"
2222

2323
# Get all example apps for this product

.github/workflows/publish-example-tutorials.yaml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
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

Comments
 (0)