Skip to content

Commit 6fb1b3d

Browse files
committed
Use PRs, fix inherited ref context for scheduled releases
Switch from direct merges to PR-based releases for better visibility and to fix cron job context inheritance issue. Clean up permissions and optimize config.
1 parent c814f73 commit 6fb1b3d

File tree

3 files changed

+51
-42
lines changed

3 files changed

+51
-42
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ on:
1616
workflow_dispatch:
1717
merge_group:
1818

19-
# Allow this workflow to be triggered by scheduled release workflows
20-
workflow_run:
21-
workflows: [ weekly-merge ]
22-
types:
23-
- completed
24-
2519
env:
2620
DOTNET_VERSION: ${{ '9.0.x' }}
2721
ENABLE_DIAGNOSTICS: true
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: scheduled-releases
2+
3+
on:
4+
schedule:
5+
# Runs every Wednesday at 08:00 UTC (midnight PST / 1:00 AM PDT)
6+
- cron: '0 8 * * 3'
7+
8+
# Allows manual triggering for convenience
9+
workflow_dispatch:
10+
11+
jobs:
12+
weekly-release:
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
# Declare to satisfy linter, will be set dynamically during workflow execution
17+
PR_NUMBER: ""
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Configure Git
24+
run: |
25+
git config user.name 'github-actions[bot]'
26+
git config user.email 'github-actions[bot]@users.noreply.github.com'
27+
28+
- name: Create weekly release PR
29+
shell: pwsh
30+
run: |
31+
# Create PR from main to rel/weekly, capture created URL
32+
$PR_URL = $(gh pr create `
33+
--base rel/weekly `
34+
--head main `
35+
--title "Scheduled weekly release $(Get-Date -Format 'yyyy-MM-dd')" `
36+
--body "Automated weekly release PR created by scheduled workflow." `
37+
--fill-verbose `
38+
--reviewer michael-hawker)
39+
40+
# Extract PR number from URL and set as environment variable
41+
$PR_NUMBER = $($PR_URL | Select-String -Pattern '\d+$').Matches[0].Value
42+
echo "PR_NUMBER=$PR_NUMBER" >> $env:GITHUB_ENV
43+
env:
44+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Enable auto-merge for the PR
47+
shell: pwsh
48+
run: |
49+
gh pr merge ${{ env.PR_NUMBER }} --auto --rebase
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/weekly-merge.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)