Skip to content

Commit 1255569

Browse files
committed
Revert to git-based merging, add reusable build workflow trigger.
1 parent ad1edb6 commit 1255569

File tree

2 files changed

+20
-39
lines changed

2 files changed

+20
-39
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
# Allows you to run this workflow manually from the Actions tab
1616
workflow_dispatch:
1717
merge_group:
18+
19+
# Allow this workflow to be called as a reusable workflow
20+
workflow_call:
1821

1922
env:
2023
DOTNET_VERSION: ${{ '9.0.x' }}

.github/workflows/scheduled-releases.yml

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,33 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12-
weekly-release:
12+
merge-weekly:
1313
runs-on: ubuntu-latest
14-
15-
env:
16-
# Declare to satisfy linter, will be set dynamically during workflow execution
17-
PR_NUMBER: ""
18-
HAS_NEW_COMMITS: ""
14+
permissions:
15+
contents: write
1916

2017
steps:
2118
- name: Checkout repository
2219
uses: actions/checkout@v4
2320
with:
24-
fetch-depth: 0
21+
# Use a token with write permissions to push to the branch
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
fetch-depth: 0 # Fetch all history for merging
2524

2625
- name: Configure Git
2726
run: |
2827
git config user.name 'github-actions[bot]'
2928
git config user.email 'github-actions[bot]@users.noreply.github.com'
3029
31-
- name: Check for new commits
32-
shell: pwsh
33-
run: |
34-
# Check if there are commits between rel/weekly and main
35-
$commitCount = git rev-list --count origin/rel/weekly..main
36-
echo "HAS_NEW_COMMITS=$($commitCount -gt 0)" >> $env:GITHUB_ENV
37-
38-
- name: Create weekly release PR
39-
if: ${{ env.HAS_NEW_COMMITS == 'true' }}
40-
shell: pwsh
41-
run: |
42-
# Create PR from main to rel/weekly, capture created URL
43-
$PR_URL = $(gh pr create `
44-
--base rel/weekly `
45-
--head main `
46-
--title "Scheduled weekly release $(Get-Date -Format 'yyyy-MM-dd')" `
47-
--fill-verbose `
48-
--reviewer michael-hawker)
49-
50-
# Extract PR number from URL and set as environment variable
51-
$PR_NUMBER = $($PR_URL | Select-String -Pattern '\d+$').Matches[0].Value
52-
echo "PR_NUMBER=$PR_NUMBER" >> $env:GITHUB_ENV
53-
env:
54-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
56-
- name: Enable auto-merge for the PR
57-
if: ${{ env.HAS_NEW_COMMITS == 'true' }}
58-
shell: pwsh
30+
- name: Merge main into rel/weekly
5931
run: |
60-
# Should result in fast-forward unless branch histories diverge
61-
gh pr merge ${{ env.PR_NUMBER }} --auto --merge
62-
env:
63-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
git fetch origin
33+
git checkout rel/weekly
34+
git reset --hard origin/rel/weekly
35+
git merge --ff-only origin/main -m "Weekly merge of main into rel/weekly"
36+
git push origin rel/weekly
37+
38+
# Then trigger the build workflow on the updated rel/weekly branch
39+
trigger-build:
40+
needs: merge-weekly
41+
uses: CommunityToolkit/Labs-Windows/.github/workflows/build.yml@rel/weekly

0 commit comments

Comments
 (0)