From 1aedf6170981150fbb0c62eb79095a1418490f4a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 11:51:26 +0000 Subject: [PATCH 1/4] Use dedicated promotion branch --- .../promote-main-to-release-candidate.yml | 29 +++++++++++++++---- .../DynamicsActivitiesPackage.csproj | 4 +-- README.md | 2 +- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/promote-main-to-release-candidate.yml b/.github/workflows/promote-main-to-release-candidate.yml index 5e81e33..5a22010 100644 --- a/.github/workflows/promote-main-to-release-candidate.yml +++ b/.github/workflows/promote-main-to-release-candidate.yml @@ -3,6 +3,9 @@ name: Promote main to release candidate on: push: branches: [main] + pull_request: + types: [synchronize] + branches: [release-candidate] workflow_dispatch: permissions: @@ -16,7 +19,11 @@ concurrency: jobs: sync: - if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }} + if: >- + github.event_name == 'push' || + (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.ref == 'automation/main-to-release-candidate') runs-on: ubuntu-latest steps: - name: Create or reuse promotion pull request @@ -25,19 +32,29 @@ jobs: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} run: | + promotion_branch="automation/main-to-release-candidate" pr_number="$(gh pr list \ --base release-candidate \ - --head main \ + --head "$promotion_branch" \ --state open \ --json number \ --jq '.[0].number // empty')" if [[ -z "$pr_number" ]]; then + main_sha="$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/heads/main" --jq '.object.sha')" + if ! gh api --method POST "repos/${GITHUB_REPOSITORY}/git/refs" \ + -f "ref=refs/heads/${promotion_branch}" \ + -f "sha=${main_sha}"; then + gh api --method PATCH "repos/${GITHUB_REPOSITORY}/git/refs/heads/${promotion_branch}" \ + -f "sha=${main_sha}" \ + -F force=true + fi + pr_number="$(gh pr create \ --base release-candidate \ - --head main \ + --head "$promotion_branch" \ --title "Sync main into release-candidate" \ - --body $'Automated promotion of the latest main branch changes into release-candidate.\n\nThis pull request is maintained by the Promote main to release candidate workflow.')" + --body $'Automated promotion of the latest main branch changes into release-candidate.\n\nThis pull request is maintained by the Promote main to release candidate workflow. Its dedicated branch allows Copilot to resolve conflicts without modifying the default branch.')" fi echo "number=$pr_number" >> "$GITHUB_OUTPUT" @@ -79,9 +96,9 @@ jobs: --jq '.[].body' | grep -Fq "$marker"; then gh pr comment "$PR_NUMBER" --body "$(cat <<'EOF' - @copilot Please resolve the merge conflicts in this pull request between `main` and `release-candidate`. + @copilot Please resolve the merge conflicts in this pull request. The head branch contains the latest `main` changes and the base is `release-candidate`. - Preserve the intended changes from both branches, run the repository's relevant checks, and push the conflict resolution to this pull request's head branch. Do not merge the pull request yourself; leave it ready for this workflow to auto-merge once it is clean. + Preserve the intended changes from both branches, run the repository's relevant checks, and push the conflict resolution to this pull request's dedicated head branch. Do not merge the pull request yourself; leave it ready for this workflow to auto-merge once it is clean. EOF )" fi diff --git a/DynamicsActivitiesPackage/DynamicsActivitiesPackage/DynamicsActivitiesPackage.csproj b/DynamicsActivitiesPackage/DynamicsActivitiesPackage/DynamicsActivitiesPackage.csproj index 1b05613..8a50cf2 100644 --- a/DynamicsActivitiesPackage/DynamicsActivitiesPackage/DynamicsActivitiesPackage.csproj +++ b/DynamicsActivitiesPackage/DynamicsActivitiesPackage/DynamicsActivitiesPackage.csproj @@ -8,8 +8,8 @@ True 10.3.0.0 - 12752 - 1.8.90 - Refresh promotion workflow registration + 1.8.91 + Use a dedicated branch for promotion conflict resolution skyline:sdk:dataminertoken skyline:sdk:dataminertoken diff --git a/README.md b/README.md index e171685..0329a1f 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ and the frontend build base path is set to `/public/DynamicsActivitiesDev/` so s | `.github/workflows/deploy-dma-on-pr-merge.yml` | Caller workflow for production-on-merge, manual `production` from `main` only, and manual `dev` deploys | | `.github/workflows/deploy-dmapp-reusable.yml` | Reusable build/register/deploy workflow for DMAPP packaging and Catalog deployment | | `.github/workflows/copilot-bug-triage.yml` | Auto-comments on `bug`-labeled issues to ask `@copilot` for investigation | -| `.github/workflows/promote-main-to-release-candidate.yml` | Opens or updates the `main` → `release-candidate` promotion PR after changes reach `main`, enables auto-merge, and asks `@copilot` to resolve conflicts | +| `.github/workflows/promote-main-to-release-candidate.yml` | Opens or updates the `main` → `release-candidate` promotion PR after changes reach `main`, using a dedicated branch so `@copilot` can resolve conflicts without modifying `main` | ### Release candidate deployment From 23102ba2b0240f88b6797514f370abe64dd75476 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 11:51:44 +0000 Subject: [PATCH 2/4] Run promotion after conflict resolution --- .github/workflows/promote-main-to-release-candidate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/promote-main-to-release-candidate.yml b/.github/workflows/promote-main-to-release-candidate.yml index 5a22010..fe9d212 100644 --- a/.github/workflows/promote-main-to-release-candidate.yml +++ b/.github/workflows/promote-main-to-release-candidate.yml @@ -3,7 +3,7 @@ name: Promote main to release candidate on: push: branches: [main] - pull_request: + pull_request_target: types: [synchronize] branches: [release-candidate] workflow_dispatch: @@ -22,7 +22,7 @@ jobs: if: >- github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || - (github.event_name == 'pull_request' && + (github.event_name == 'pull_request_target' && github.event.pull_request.head.ref == 'automation/main-to-release-candidate') runs-on: ubuntu-latest steps: From 86017d67fb067c9f070ae301601be27be8a1f366 Mon Sep 17 00:00:00 2001 From: ToonCasteele <99814254+ToonCasteele@users.noreply.github.com> Date: Fri, 17 Jul 2026 13:56:10 +0200 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/promote-main-to-release-candidate.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/promote-main-to-release-candidate.yml b/.github/workflows/promote-main-to-release-candidate.yml index fe9d212..cf087d1 100644 --- a/.github/workflows/promote-main-to-release-candidate.yml +++ b/.github/workflows/promote-main-to-release-candidate.yml @@ -23,7 +23,8 @@ jobs: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request_target' && - github.event.pull_request.head.ref == 'automation/main-to-release-candidate') + github.event.pull_request.head.ref == 'automation/main-to-release-candidate' && + github.event.pull_request.head.repo.full_name == github.repository) runs-on: ubuntu-latest steps: - name: Create or reuse promotion pull request From 86b3667006e6459cdaacc6a07183aaaf935e5698 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Jul 2026 11:58:09 +0000 Subject: [PATCH 4/4] Keep promotion branch current safely --- .../promote-main-to-release-candidate.yml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/promote-main-to-release-candidate.yml b/.github/workflows/promote-main-to-release-candidate.yml index cf087d1..7d5b39e 100644 --- a/.github/workflows/promote-main-to-release-candidate.yml +++ b/.github/workflows/promote-main-to-release-candidate.yml @@ -34,6 +34,17 @@ jobs: GH_REPO: ${{ github.repository }} run: | promotion_branch="automation/main-to-release-candidate" + main_sha="$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/heads/main" --jq '.object.sha')" + if ! gh api --method POST "repos/${GITHUB_REPOSITORY}/git/refs" \ + -f "ref=refs/heads/${promotion_branch}" \ + -f "sha=${main_sha}"; then + if ! gh api --method PATCH "repos/${GITHUB_REPOSITORY}/git/refs/heads/${promotion_branch}" \ + -f "sha=${main_sha}" \ + -F force=false; then + echo "Promotion branch has diverged from main; leaving it unchanged for conflict resolution." + fi + fi + pr_number="$(gh pr list \ --base release-candidate \ --head "$promotion_branch" \ @@ -42,15 +53,6 @@ jobs: --jq '.[0].number // empty')" if [[ -z "$pr_number" ]]; then - main_sha="$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/heads/main" --jq '.object.sha')" - if ! gh api --method POST "repos/${GITHUB_REPOSITORY}/git/refs" \ - -f "ref=refs/heads/${promotion_branch}" \ - -f "sha=${main_sha}"; then - gh api --method PATCH "repos/${GITHUB_REPOSITORY}/git/refs/heads/${promotion_branch}" \ - -f "sha=${main_sha}" \ - -F force=true - fi - pr_number="$(gh pr create \ --base release-candidate \ --head "$promotion_branch" \