-
Notifications
You must be signed in to change notification settings - Fork 1.4k
51 lines (51 loc) · 1.82 KB
/
release-merge.yaml
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
name: Merge release changes to main
on:
push:
branches:
- "release-[0-9]+.[0-9]+"
env:
VERSION_FILE: pkg/version/release.go
DEFAULT_BRANCH: main
jobs:
merge_release:
name: Merge release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 #v4.1.0
with:
fetch-depth: 0
- name: Setup identity as eksctl-bot
uses: ./.github/actions/setup-identity
with:
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Merge release branch into ${{env.DEFAULT_BRANCH}}
id: merge-changes
run: |
git checkout $DEFAULT_BRANCH
git checkout -b merge-${{ github.sha }}
if [ "$(git merge --no-commit --no-ff ${{ github.ref }})" = "Already up to date." ]; then
exit 0;
fi
git checkout ORIG_HEAD -- $VERSION_FILE
git add $VERSION_FILE
EDITOR=true git merge --continue
! git diff --exit-code $DEFAULT_BRANCH...HEAD || exit 1
git push --set-upstream origin HEAD
echo "changes=true" >> $GITHUB_OUTPUT
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
name: Open PR to ${{env.DEFAULT_BRANCH}}
if: steps.merge-changes.outputs.changes == 'true'
with:
github-token: ${{ secrets.EKSCTLBOT_TOKEN }}
script: |
const { data: pr } = await github.pulls.create({
...context.repo,
title: `Merge ${context.ref} to ${{ env.DEFAULT_BRANCH }}`,
head: `merge-${context.sha}`,
base: "${{ env.DEFAULT_BRANCH }}",
});
await github.issues.addLabels({
...context.repo,
issue_number: pr.number,
labels: ["skip-release-notes"],
});