-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (90 loc) · 3.2 KB
/
Copy pathgodoc.yml
File metadata and controls
107 lines (90 loc) · 3.2 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Print Go API changes
on:
workflow_call:
secrets:
PROBE_APP_ID:
required: true
PROBE_APP_PRIVATE_KEY:
required: true
inputs:
go-version:
type: string
default: "1.19"
env:
GOPRIVATE: github.com/TykTechnologies
jobs:
test:
name: Detect Go API changes
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1
with:
app-id: ${{ secrets.PROBE_APP_ID }}
private-key: ${{ secrets.PROBE_APP_PRIVATE_KEY }}
owner: TykTechnologies
- name: Use GitHub Token
env:
TOKEN: ${{ steps.app-token.outputs.token }}
run: >
git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/"
- name: Checkout repo
uses: TykTechnologies/github-actions/.github/actions/checkout-pr@75796ad54ffce9f0036f036414f8c9fb3dc5c0e0 # main
with:
token: ${{ steps.app-token.outputs.token }}
- name: Checkout exp
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 1
repository: TykTechnologies/exp
ref: main
path: exp
- name: Setup Go
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4
with:
go-version: ${{ inputs.go-version }}
- name: Install Task
uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1
with:
version: 3
- name: Set up comment author
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Collect API docs
run: |
cp ./exp/.taskfiles/godoc/Taskfile.yml ./Taskfile.godoc.yml
go mod tidy
task -t Taskfile.godoc.yml > current.txt
git checkout -- .
git fetch --depth=1 origin ${{ github.base_ref }}
git checkout ${{ github.base_ref }}
go mod tidy
task -t Taskfile.godoc.yml > prev.txt
- name: Diff API docs
id: api-check
run: |
set +e
diff -u prev.txt current.txt > changes.txt
echo "diff-output<<EOF" >> $GITHUB_OUTPUT
cat changes.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@a54c31d7fa095754bfef525c0c8e5e5674c4b4b1 # v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: API Changes
- name: Create or update comment
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
API Changes
```diff
${{ steps.api-check.outputs.diff-output || 'no api changes detected' }}
```
edit-mode: replace