Skip to content

Commit a4d5729

Browse files
Create PR
1 parent b628bc2 commit a4d5729

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/ta-tests.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,22 @@ jobs:
257257
git config --global user.email "${{ secrets.SA_GH_USER_EMAIL }}"
258258
git commit -S -m "CI: UCC build for ${{ github.event_name }} event"
259259
git push --force origin $GIT_BRANCH
260-
260+
- name: Create a PR if it does not exist yet
261+
if: success() && github.event.inputs.run_pipelines == 'true'
262+
working-directory: TA
263+
env:
264+
GH_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}
265+
run: |
266+
# Check if a PR already exists
267+
if gh pr view -R ${{ matrix.target_repo }} $GIT_BRANCH; then
268+
echo "PR already exists, not creating a new one"
269+
exit 0
270+
fi
271+
272+
echo "Creating a new draft PR from branch $GIT_BRANCH to ${{ github.event.inputs.target_branch }}"
273+
gh pr create -R ${{ matrix.target_repo }} --title "CI: UCC build for ${{ github.event_name }} event" \
274+
--body "This PR was created automatically to trigger the build-test-release pipeline." \
275+
--base ${{ github.event.inputs.target_branch }} --head $GIT_BRANCH --draft
261276
- name: Obtain the workflow run ID
262277
if: success() && github.event.inputs.run_pipelines == 'true'
263278
id: get-workflow-run-id

0 commit comments

Comments
 (0)