Skip to content

Commit 0ec7b79

Browse files
committed
ci: Create a PR in push-components
1 parent a8278ac commit 0ec7b79

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/push-components.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,29 @@ jobs:
5656
git config user.name "github-actions[bot]"
5757
git config user.email "github-actions[bot]@users.noreply.github.com"
5858
59-
- name: Push obelisk-oci.toml
59+
60+
- name: Generate Unique Branch Name
61+
id: branch-name
62+
run: echo "branch_name=push-components-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
63+
64+
- name: Create a PR
6065
run: |
66+
git checkout -b ${{ steps.branch-name.outputs.branch_name }}
6167
git add .
6268
git commit -m "chore: Bump components to $TAG"
63-
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
64-
git push origin ${{ github.event.inputs.ref }}
69+
git push origin ${{ steps.branch-name.outputs.branch_name }}
70+
OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
71+
REPO=$(echo "${{ github.repository }}" | cut -d'/' -f2)
72+
curl -v --fail -X POST \
73+
-H "Content-Type: application/json" \
74+
-H "Authorization: Bearer $GITHUB_TOKEN" \
75+
https://api.github.com/repos/$OWNER/$REPO/pulls \
76+
-d '{
77+
"title": "chore: Bump components",
78+
"head": "'${{ steps.branch-name.outputs.branch_name }}'",
79+
"base": "main",
80+
"body": ""
81+
}'
6582
env:
6683
TAG: ${{ github.event.inputs.tag }}
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PR_RW }}

0 commit comments

Comments
 (0)