forked from antrea-io/antrea
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (57 loc) · 1.82 KB
/
update_changelog.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
54
55
56
57
58
59
60
name: Update CHANGELOG after release
on:
push:
tags:
- v*
jobs:
check-version:
runs-on: [ubuntu-latest]
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Extract version from Github ref
id: get-version
env:
TAG: ${{ github.ref }}
shell: bash
run: |
version=${TAG:10}
if [[ "$version" == *-* ]]; then
echo "$version is a release candidate or a pre-release"
exit 0
fi
echo "version=$version" >> $GITHUB_OUTPUT
pr-update-changelog:
runs-on: [ubuntu-latest]
needs: check-version
if: ${{ needs.check-version.outputs.version != '' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Cherry-pick changelog commit
env:
VERSION: ${{ needs.check-version.outputs.version }}
shell: bash
run: |
git config user.name github-actions
git config user.email [email protected]
commit_hash=$(git log "$VERSION" --format="%H" --grep="Update CHANGELOG for $VERSION release")
if [[ -z "$commit_hash" ]]; then
echo "Cannot find commit"
exit 1
fi
git cherry-pick "$commit_hash"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.ANTREA_BOT_WRITE_PAT }}
delete-branch: true
title: "Update CHANGELOG for ${{ needs.check-version.outputs.version }} release"
body: |
PR was opened automatically from Github Actions
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"