Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions .github/workflows/promote-main-to-release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Promote main to release candidate
on:
push:
branches: [main]
pull_request_target:
types: [synchronize]
branches: [release-candidate]
workflow_dispatch:

permissions:
Expand All @@ -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_target' &&
github.event.pull_request.head.ref == 'automation/main-to-release-candidate')
Comment thread
Copilot marked this conversation as resolved.
Outdated
runs-on: ubuntu-latest
steps:
- name: Create or reuse promotion pull request
Expand All @@ -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 \
Comment on lines +36 to 51
--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"
Expand Down Expand Up @@ -79,9 +96,9 @@ jobs:
--jq '.[].body' | grep -Fq "$marker"; then
gh pr comment "$PR_NUMBER" --body "$(cat <<'EOF'
<!-- automated-main-to-rc-conflict-request -->
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<GenerateDataMinerPackage>True</GenerateDataMinerPackage>
<MinimumRequiredDmVersion>10.3.0.0 - 12752</MinimumRequiredDmVersion>
<!-- <MinimumRequiredDmWebVersion>10.6.2 (CU0)</MinimumRequiredDmWebVersion> -->
<Version>1.8.90</Version>
<VersionComment>Refresh promotion workflow registration</VersionComment>
<Version>1.8.91</Version>
<VersionComment>Use a dedicated branch for promotion conflict resolution</VersionComment>
<!-- Do NOT fill in the Organization Token here. This points to either an Environment Variable skyline__sdk__dataminertoken holding the organization token or a Visual Studio User Secret holding the token. -->
<CatalogPublishKeyName>skyline:sdk:dataminertoken</CatalogPublishKeyName>
<CatalogDefaultDownloadKeyName>skyline:sdk:dataminertoken</CatalogDefaultDownloadKeyName>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down