-
Notifications
You must be signed in to change notification settings - Fork 13
53 lines (47 loc) · 1.78 KB
/
pr_merged.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Formal Ledger Specs - PR Merged
on:
pull_request:
branches:
- master
types:
- closed
permissions:
contents: write
env:
MAlonzo_branch: ${{ github.event.pull_request.head.ref }}-MAlonzo
jobs:
pr-merged:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: MAlonzo-code
- name: Merge ${{ env.MAlonzo_branch }} into MAlonzo-code
if: github.event.pull_request.merged
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
# GitHub Actions fetches shallow copies of remote branches
# which might not be ideal when rebasing, hence use `--unshallow`.
git fetch --unshallow origin ${{ env.MAlonzo_branch }}
git checkout ${{ env.MAlonzo_branch }}
# During `git rebase` 'ours' and 'theirs' are flipped
# so what we do here is that we keep the changes from ${{ env.MAlonzo_branch }}.
git rebase -X theirs origin/MAlonzo-code
git checkout MAlonzo-code
git merge --squash ${{ env.MAlonzo_branch }}
git commit -m "Generate code for GH-${{ github.event.pull_request.number }}" || echo "Everything is up-to-date."
- name: Push MAlonzo-code
if: github.event.pull_request.merged
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: MAlonzo-code
force: false
directory: .
- name: Delete ${{ env.MAlonzo_branch }} branch
if: github.event.pull_request.merged
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: ${{ env.MAlonzo_branch }}