Skip to content

Commit 6a0c4ad

Browse files
committed
add auto merge and cron
1 parent 33c9a67 commit 6a0c4ad

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Force Merge Canary Release PR
2+
3+
on: pull_request
4+
5+
# Limit the permissions of GITHUB_TOKEN for this
6+
# workflow which is good practice.
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
force-merge-canary-release-pr:
12+
runs-on: ubuntu-latest
13+
# Validate the login, PR title, and the label to ensure the PR is
14+
# from the release PR and prevent spoofing.
15+
if: |
16+
github.event.pull_request.user.login == 'vercel-release-bot' &&
17+
github.event.pull_request.title == 'Version Packages (canary)' &&
18+
contains(github.event.pull_request.labels.*.name, 'created-by: CI')
19+
steps:
20+
- name: Bypass required status checks and merge PR
21+
run: gh pr merge --admin --squash "$PR_URL"
22+
env:
23+
PR_URL: ${{github.event.pull_request.html_url}}
24+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/trigger_release_new.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
name: Trigger Release (New)
22

33
on:
4+
# Run every day at 23:15 UTC
5+
schedule:
6+
- cron: '15 23 * * *'
7+
# Run manually
48
workflow_dispatch:
59
inputs:
610
releaseType:
711
description: Release Type
812
required: true
913
type: choice
14+
# Cron job will run canary release
15+
default: canary
1016
options:
1117
- canary
1218
- stable
@@ -22,6 +28,11 @@ env:
2228
TURBO_VERSION: 2.3.3
2329
NODE_LTS_VERSION: 20
2430

31+
# Limit the permissions of GITHUB_TOKEN for this
32+
# workflow which is good practice.
33+
permissions:
34+
pull-requests: write
35+
2536
jobs:
2637
start:
2738
if: github.repository_owner == 'vercel'
@@ -99,7 +110,16 @@ jobs:
99110
with:
100111
version: pnpm ci:version
101112
publish: pnpm ci:publish
113+
title: Version Packages (${{ github.event.inputs.releaseType }})
114+
commit: Version Packages (${{ github.event.inputs.releaseType }})
102115
env:
103116
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
104117
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
105118
RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
119+
120+
# Add label to verify the PR is created from this workflow.
121+
- name: Add label to PR
122+
if: steps.changesets.outputs.pullRequestNumber
123+
run: 'gh pr edit ${{ steps.changesets.outputs.pullRequestNumber }} --add-label "created-by: CI"'
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)