Skip to content

Commit 1e9cc7c

Browse files
committed
Change uplift process to branch-specific pull requests
1 parent 7f64b28 commit 1e9cc7c

4 files changed

Lines changed: 68 additions & 156 deletions

File tree

.github/workflows/pulls-merged.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: PR Merged Actions
55
# Don't add any steps that act on external code.
66
on:
77
pull_request_target:
8-
branches: [main]
8+
branches: [main, beta, release]
99
types: [closed]
1010

1111
permissions:
@@ -32,16 +32,24 @@ jobs:
3232
PR_NUMBER: ${{ github.event.pull_request.number }}
3333
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
3434
run: |
35-
# The furthest open milestone in the future should be current main
36-
gh api repos/$GITHUB_REPOSITORY/milestones --jq '
37-
map(select(.state == "open" and .due_on != null))
35+
# There should be exactly 3 milestones open at all times
36+
TARGET_BRANCH="${{ github.base_ref }}"
37+
case "$TARGET_BRANCH" in
38+
main) milestone_index=0 ;;
39+
beta) milestone_index=1 ;;
40+
release) milestone_index=2 ;;
41+
esac
42+
echo "$milestone_index"
43+
gh api repos/$GITHUB_REPOSITORY/milestones --jq "
44+
map(select(.state == \"open\" and .due_on != null))
3845
| sort_by(.due_on) | reverse
39-
| .[0] | { number, title }
46+
| .[${milestone_index}] | { number, title }
4047
| to_entries
41-
| map(.key + "=" + (.value|tostring)) | join("\n")' | tee -a $GITHUB_OUTPUT
48+
| map(.key + \"=\" + (.value|tostring)) | join(\"\n\")" | tee -a $GITHUB_OUTPUT
4249
4350
- name: Thank you
4451
if: |
52+
github.base_ref == 'main' &&
4553
github.event.pull_request.author_association != 'OWNER' &&
4654
github.event.pull_request.author_association != 'MEMBER' &&
4755
github.event.pull_request.author_association != 'COLLABORATOR' &&

.github/workflows/pulls-opened.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: PR Opened Actions
3+
4+
# Warning, this job is running on pull_request_target and therefore has access to issue content.
5+
# Don't add any steps that act on external code.
6+
on:
7+
pull_request_target:
8+
branches: [beta, release]
9+
types: [opened]
10+
11+
permissions:
12+
pull-requests: write
13+
14+
jobs:
15+
pull-request-opened:
16+
runs-on: ubuntu-latest
17+
environment: botmobile
18+
steps:
19+
- name: App token generate
20+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
21+
if: ${{ vars.BOT_CLIENT_ID }}
22+
id: app-token
23+
with:
24+
app-id: ${{ vars.BOT_CLIENT_ID }}
25+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
26+
27+
- name: Uplift Approval Request
28+
env:
29+
PR_NUMBER: ${{ github.event.pull_request.number }}
30+
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
31+
MILESTONE: ${{ steps.milestone.outputs.title }}
32+
MESSAGE: |
33+
Thank you for your uplift request! Please add a comment with the following approval request template filled out.
34+
35+
**[Approval Request]**
36+
Original Issue/Pull request:
37+
Regression caused by (issue #):
38+
User impact if declined:
39+
Testing completed (on daily, etc.):
40+
Risk to taking this patch (and alternatives if risky):
41+
run: |
42+
if gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json comments \
43+
--jq '.comments[].body' | grep -q '\[Approval Request\]'; then
44+
echo "Approval Request already exists. Skipping comment."
45+
exit 0
46+
fi
47+
48+
gh pr comment "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --body "$MESSAGE"

docs/ci/RELEASE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ The app-k9mail/src/main/res/raw/changelog_master.xml should not include any beta
191191

192192
## Branch Uplifts
193193

194-
If the urgency of a fix requires it to be included in the Beta or Release channel before the next merge, the uplift process is followed. If possible, uplifts should be avoided and patches should “ride the train” instead, following the merge day cycle.
194+
If the urgency of a fix requires it to be included in the Beta or Release channel before the next merge, the uplift process is followed.
195+
If possible, uplifts should be avoided and patches should “ride the train” instead, following the merge day cycle.
195196

196197
### Uplift Criteria
197198

@@ -210,15 +211,14 @@ Release uplifts should additionally:
210211

211212
### Uplift Process
212213

213-
1. The requestor adds the "task: uplift to beta" or "task: uplift to release" label to a merged pull request.
214-
2. The requestor makes a comment in the associated issue with the Approval Request Comment template filled out.
215-
3. The release driver reviews all uplift requests and, retaining the label for approved uplifts and removing the label for rejected uplifts.
216-
4. The release driver runs the Uplift Merges action for the specified target branch, which will remove the label, adjust the milestone, cherry-pick the commits, and push to the target branch.
214+
1. The requestor creates a pull request against the target uplift branch.
215+
2. The requestor adds a comment to the pull request with the Approval Request template filled out.
216+
3. The release driver reviews the uplift request, merging if approved, or closing with a comment if rejected.
217217

218218
Template for uplift requests:
219219

220220
```sh
221-
[Approval Request Comment]
221+
[Approval Request]
222222
Original Issue/Pull request:
223223
Regression caused by (issue #):
224224
User impact if declined:

scripts/ci/uplift-merges.sh

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

0 commit comments

Comments
 (0)