Skip to content

Commit

Permalink
Move the make gen check as part of the lint workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
  • Loading branch information
rdimitrov committed May 31, 2024
1 parent a95a10f commit 18ee236
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 41 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/check-make-gen.yml

This file was deleted.

42 changes: 34 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,45 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1

mod-tidy:
name: Go mod tidy
check-go-mod-tidy-and-make-gen:
name: Check for uncommitted changes - go mod tidy and make gen
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: false
- name: go mod tidy
- name: Run go mod tidy
run: go mod tidy
- name: git diff
run: git diff --exit-code
- name: Output message
if: ${{ failure() }}
run: echo "Please run 'go mod tidy' and commit changes"
- name: Check for uncommitted changes - go mod tidy
run: |
if [ -n "$(git diff)" ]; then
echo -e "\e[91m**********************************************************************************************\e[0m"
echo -e "\e[91m* Uncommitted changes found. Please run 'go mod tidy' and commit changes. *\e[0m"
echo -e "\e[91m**********************************************************************************************\e[0m"
git diff
exit 1
else
echo -e "\e[92m**********************************************************************************************\e[0m"
echo -e "\e[92m* No uncommitted changes found. *\e[0m"
echo -e "\e[92m**********************************************************************************************\e[0m"
fi
- name: Run make bootstrap to download the tool dependencies
run: |
make bootstrap
- name: Run make gen
run: make gen
- name: Check for uncommitted changes - make gen
run: |
if [ -n "$(git diff)" ]; then
echo -e "\e[91m**********************************************************************************************\e[0m"
echo -e "\e[91m* Uncommitted changes found. Please run 'make gen' and commit the changes. *\e[0m"
echo -e "\e[91m**********************************************************************************************\e[0m"
git diff
exit 1
else
echo -e "\e[92m**********************************************************************************************\e[0m"
echo -e "\e[92m* No uncommitted changes found. *\e[0m"
echo -e "\e[92m**********************************************************************************************\e[0m"
fi
2 changes: 0 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ permissions:
contents: read

jobs:
check-make-gen:
uses: ./.github/workflows/check-make-gen.yml
license-check:
uses: ./.github/workflows/license-check.yml
lint:
Expand Down

0 comments on commit 18ee236

Please sign in to comment.