forked from openshift/configuration-anomaly-detection
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.37 KB
/
auto-tidy-interceptor.yml
File metadata and controls
51 lines (43 loc) · 1.37 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
name: Auto tidy interceptor after cadctl changes
on:
pull_request_target:
types: [opened, synchronize]
paths:
- 'go.mod'
- 'go.sum'
- '**/*.go'
- '!interceptor/**'
permissions:
contents: write
pull-requests: write
jobs:
tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run go mod tidy in interceptor
working-directory: interceptor
run: go mod tidy
- name: Check for changes when run go mod tidy in interceptor
id: diffcheck
run: |
if [[ -n "$(git status --porcelain interceptor/go.mod interceptor/go.sum)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push if there are changes
if: steps.diffcheck.outputs.changes == 'true'
uses: EndBug/add-and-commit@v9
with:
message: "On PR: tidy interceptor go.mod after cadctl go.mod update"
add: "interceptor/go.mod interceptor/go.sum"