-
Notifications
You must be signed in to change notification settings - Fork 1.2k
58 lines (58 loc) · 2.18 KB
/
go_mod_tidy.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
name: "Run Go Mod Tidy And Generate Licenses"
on:
pull_request:
types:
- labeled
push:
branches:
- mq-working-branch-*
workflow_dispatch:
inputs:
pr_number:
description: "PR number"
required: true
type: number
permissions:
contents: write
jobs:
mod_tidy_and_generate_licenses:
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies-go')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Checkout PR
# run only if triggered manually, otherwise we are already on the right branch and we won't have `pr_number`
if: ${{ github.event_name == 'workflow_dispatch' }}
run: gh pr checkout ${{ github.event.inputs.pr_number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install go
uses: actions/setup-go@v3
with:
go-version-file: ".go-version"
- name: Install python
uses: actions/setup-python@v4
with:
python-version: "3.9.12"
cache: "pip"
- name: Install python requirements.txt
run: python3 -m pip install -r requirements.txt
- name: Go mod tidy
run: inv -e tidy-all
- name: Update LICENSE-3rdparty.csv
if: ${{ github.event_name == 'workflow_dispatch' || !contains(github.event.pull_request.labels.*.name, 'dependencies-go-tools') }}
run: |
inv -e install-tools
inv -e generate-licenses
- name: Update mocks
if: ${{ github.event_name == 'workflow_dispatch' || !contains(github.event.pull_request.labels.*.name, 'dependencies-go-tools') }}
run: inv -e security-agent.gen-mocks # generate both security agent and process mocks
- uses: stefanzweifel/git-auto-commit-action@v4
id: autocommit
with:
commit_message: Auto-generate go.sum and LICENSE-3rdparty.csv changes
- name: changes
run: |
echo "Changes detected: ${{ steps.autocommit.outputs.changes_detected }}"