Skip to content

Commit

Permalink
chore: add status-check-go (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato authored Jul 25, 2024
1 parent 50c12c9 commit ee23a59
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 8 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,34 @@ name: actionlint

on:
pull_request:
branches: [main]
paths:
- ".github/workflows/*"

jobs:
path-filter:
outputs:
workflows: ${{steps.changes.outputs.workflows}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
workflows:
- '.github/workflows/*'
status-check-actionlint:
runs-on: ubuntu-latest
needs:
- actionlint
permissions: {}
if: failure()
steps:
- run: exit 1

actionlint:
needs: path-filter
if: ${{ needs.path-filter.outputs.workflows == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
36 changes: 32 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,42 @@ name: go

on:
pull_request:
paths:
- 'contents/kubernetes-operator/**.go'
- .github/workflows/go.yml
- '**go**'
push:
branches:
- main

jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
go: ${{ steps.filter.outputs.go }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
go:
- 'contents/kubernetes-operator/**.go'
- .github/workflows/go.yml
- '**go**'
status-check-go:
runs-on: ubuntu-latest
needs:
- test
- golangci-lint
permissions: {}
if: failure()
steps:
- run: exit 1

test:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
runs-on: ubuntu-latest
steps:
- name: checkout
Expand All @@ -30,6 +56,8 @@ jobs:
uses: codecov/codecov-action@v3

golangci-lint:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
runs-on: ubuntu-latest
steps:
- name: checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 'pypy3.9'
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].1

0 comments on commit ee23a59

Please sign in to comment.