5353 VERSION=$(jq -r .version ../create-hyperweb-app/templates/hyperweb/package.json)
5454 echo "version=$VERSION" >> $GITHUB_OUTPUT
5555
56+ - name : Get GIT_HASH from Hyperweb-Boilerplate
57+ id : git_hash
58+ run : |
59+ SHORT_HASH=$(git -C ../hyperweb-boilerplate rev-parse --short HEAD)
60+ echo "git_hash=$SHORT_HASH" >> $GITHUB_OUTPUT
61+
5662 - name : Copy and Apply Changes to Create-Hyperweb-App
5763 run : |
5864 rsync -av --exclude='.git' ./ ../create-hyperweb-app/templates/hyperweb/ --delete
@@ -70,30 +76,33 @@ jobs:
7076 fi
7177
7278 - name : Commit and Push Changes
79+ id : push_changes
7380 run : |
7481 cd ../create-hyperweb-app
75- # Get the short commit hash from the hyperweb-boilerplate repository
76- SHORT_HASH=$(git -C ../hyperweb-boilerplate rev-parse --short HEAD)
77-
78- # Add changes
7982 git add .
80-
81- # Check if there are any changes to commit
8283 if ! git diff-index --quiet HEAD; then
84+ SHORT_HASH="${{ steps.git_hash.outputs.git_hash }}"
8385 NEW_BRANCH="sync/hyperweb-boilerplate-update-${SHORT_HASH}-$(date +%Y%m%d%H%M)"
8486 git checkout -b $NEW_BRANCH
8587 git commit -m "Sync changes from hyperweb-boilerplate for commit ${SHORT_HASH}"
8688 git push origin $NEW_BRANCH
89+ echo "new_branch=$NEW_BRANCH" >> $GITHUB_OUTPUT
8790 fi
8891
8992 - name : Create Pull Request
90- uses : peter-evans/create-pull-request@v5
91- with :
92- token : ${{ secrets.PAT_TOKEN }} # Use PAT for private repo access
93- repository : hyperweb-io/create-hyperweb-app
94- base : main
95- head : sync/hyperweb-boilerplate-update-${{ steps.get_version.outputs.version }}-$(date +%Y%m%d%H%M)
96- title : " Sync boilerplate changes for version ${{ steps.get_version.outputs.version }}"
97- body : |
98- This PR contains the latest boilerplate changes from hyperweb-boilerplate for version ${{ steps.get_version.outputs.version }}.
99- Also includes updates from the changelog file.
93+ run : |
94+ NEW_BRANCH=${{ steps.push_changes.outputs.new_branch }}
95+ PR_URL=$(curl -s -X POST \
96+ -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \
97+ -H "Accept: application/vnd.github.v3+json" \
98+ https://api.github.com/repos/hyperweb-io/create-hyperweb-app/pulls \
99+ -d @- << EOF
100+ {
101+ "title": "Sync boilerplate changes for commit ${NEW_BRANCH}",
102+ "head": "${NEW_BRANCH}",
103+ "base": "main",
104+ "body": "This PR contains the latest boilerplate changes from hyperweb-boilerplate for branch ${NEW_BRANCH}. Also includes updates from the changelog file."
105+ }
106+ EOF
107+ )
108+ echo "Pull request created: $PR_URL"
0 commit comments