diff --git a/.github/workflows/update-feature-branches.yml b/.github/workflows/update-feature-branches.yml index 5e180d2611..b9ea97f4ee 100644 --- a/.github/workflows/update-feature-branches.yml +++ b/.github/workflows/update-feature-branches.yml @@ -17,6 +17,8 @@ env: defaultBranchPattern: "feature_branch/*" defaultMainBranch: "main" triggerTestsLabel: "tests-requested: quick" + branchPrefix: "workflow/auto-merge-feature-branch-" + jobs: list_feature_branches: @@ -85,6 +87,11 @@ jobs: python scripts/gha/install_prereqs_desktop.py python -m pip install requests + - name: Name new branch + run: | + date_str=$(date "+%Y%m%d-%H%M%S") + echo "NEW_BRANCH=${{env.branchPrefix}}${{github.run_number}}-${date_str}" >> $GITHUB_ENV + - name: Create merge PR id: create-pr run: | @@ -115,7 +122,10 @@ jobs: > Created on ${date_str} by [${{github.workflow}} workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID). " - pr_number=$(python scripts/gha/create_pull_request.py --token ${{ steps.generate-token.outputs.token }} --base "${{ matrix.branch_name }}" --head "${main_branch}" --title "${pr_title}" --body "${pr_body}") + git checkout main + git checkout -b "${NEW_BRANCH}" + git push --set-upstream origin "${NEW_BRANCH}" + pr_number=$(python scripts/gha/create_pull_request.py --token ${{ steps.generate-token.outputs.token }} --base "${{ matrix.branch_name }}" --head "${NEW_BRANCH}" --title "${pr_title}" --body "${pr_body}") echo "created_pr_number=${pr_number}" >> $GITHUB_OUTPUT - name: Set test trigger label.