Skip to content

Commit fd5b6a1

Browse files
vearutopnhatthm
andauthored
Add gorelease GitHub Action task (#493)
* Add gorelease GitHub Action task * Update .github/workflows/gorelease.yml Co-authored-by: Nhat <[email protected]> Co-authored-by: Nhat <[email protected]>
1 parent 6f3e792 commit fd5b6a1

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/gorelease.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Gorelease comments public API changes to pull request.
2+
name: gorelease
3+
on:
4+
pull_request:
5+
6+
# Cancel the workflow in progress in newer build is about to start.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
env:
12+
GO_VERSION: 1.19.x
13+
jobs:
14+
gorelease:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Install Go stable
18+
if: env.GO_VERSION != 'tip'
19+
uses: actions/setup-go@v3
20+
with:
21+
go-version: ${{ env.GO_VERSION }}
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
- name: Gorelease cache
25+
uses: actions/cache@v2
26+
with:
27+
path: |
28+
~/go/bin/gorelease
29+
key: ${{ runner.os }}-gorelease-generic
30+
- name: Gorelease
31+
id: gorelease
32+
run: |
33+
test -e ~/go/bin/gorelease || go install golang.org/x/exp/cmd/gorelease@latest
34+
OUTPUT=$(gorelease 2>&1 || exit 0)
35+
echo "${OUTPUT}"
36+
OUTPUT="${OUTPUT//$'\n'/%0A}"
37+
echo "::set-output name=report::$OUTPUT"
38+
- name: Comment Report
39+
continue-on-error: true
40+
uses: marocchino/sticky-pull-request-comment@v2
41+
with:
42+
header: gorelease
43+
message: |
44+
### Go API Changes
45+
46+
<pre>
47+
${{ steps.gorelease.outputs.report }}
48+
</pre>

0 commit comments

Comments
 (0)