2022-11-17 04:06:42 -05:00
|
|
|
name: Shellfmt
|
2022-11-10 10:14:57 -05:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- "release/**"
|
|
|
|
paths:
|
|
|
|
- "**.sh"
|
|
|
|
- "**.bash"
|
2023-01-16 08:24:05 -05:00
|
|
|
- "image/**"
|
2023-02-14 14:01:00 -05:00
|
|
|
- ".github/workflows/test-shellfmt.yml"
|
2022-11-10 10:14:57 -05:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- "**.sh"
|
|
|
|
- "**.bash"
|
2023-01-16 08:24:05 -05:00
|
|
|
- "image/**"
|
2023-02-14 14:01:00 -05:00
|
|
|
- ".github/workflows/test-shellfmt.yml"
|
2022-11-10 10:14:57 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
shellcheck:
|
|
|
|
name: Shellfmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-01-05 10:17:51 -05:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
2022-11-10 10:14:57 -05:00
|
|
|
with:
|
2022-12-19 09:21:28 -05:00
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
2022-11-10 10:14:57 -05:00
|
|
|
|
|
|
|
- name: Setup Go environment
|
2022-12-14 08:55:14 -05:00
|
|
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
2022-11-10 10:14:57 -05:00
|
|
|
with:
|
2023-03-08 04:05:36 -05:00
|
|
|
go-version: "1.20.2"
|
2022-11-10 10:14:57 -05:00
|
|
|
|
|
|
|
- name: Install shellfmt
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-01-11 04:17:31 -05:00
|
|
|
go install github.com/katexochen/sh/v3/cmd/shfmt@faf7f58964998201d22efe41fef41ae4e1953f3b # v3.6.0
|
2022-11-10 10:14:57 -05:00
|
|
|
|
|
|
|
- name: Run shellfmt
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-11-14 07:20:36 -05:00
|
|
|
# shellcheck disable=SC2046
|
|
|
|
shfmt -i 2 -d -s -sr $(shfmt -f . | grep -v helm/charts/cilium)
|