diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 4262656..c3d9c54 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -22,7 +22,7 @@ jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index fae8822..3be4070 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,36 +1,27 @@ -# This is a basic workflow to help you get started with Actions - name: shellcheck -# Controls when the action will run. on: push: branches: - main - dev paths: - - 'entrypoint.sh' + - '**.sh' - '.github/workflows/shellcheck.yml' pull_request: branches: - main - dev paths: - - 'entrypoint.sh' + - '**.sh' - '.github/workflows/shellcheck.yml' -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest + lint: + runs-on: ubuntu-20.04 - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - # Runs a single command using the runners shell - uses: ludeeus/action-shellcheck@1.0.0 diff --git a/.github/workflows/shfmt.yml b/.github/workflows/shfmt.yml new file mode 100644 index 0000000..d704416 --- /dev/null +++ b/.github/workflows/shfmt.yml @@ -0,0 +1,35 @@ +name: shfmt + +on: + push: + branches: + - main + - dev + paths: + - '**.sh' + - '.github/workflows/shfmt.yml' + pull_request: + branches: + - main + - dev + paths: + - '**.sh' + - '.github/workflows/shfmt.yml' + +jobs: + format: + env: + SHFMT_VERSION: 3.0.1 + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - name: Install shfmt + run: | + sudo wget "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/shfmt_v${SHFMT_VERSION}_linux_amd64" -O /usr/local/bin/shfmt + sudo chmod +x /usr/local/bin/shfmt + + - name: Check .sh files + run: shfmt -d . + diff --git a/README.md b/README.md index bfe2f4a..d08b661 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +| Tag | Docker Image CI | shellcheck | shfmt | +|--------|-----------------|------------|-------| +| v2.0.0 | ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg?branch=v2.0.0) | ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg?branch=v2.0.0) | ![shfmt](https://github.com/jidicula/clang-format-action/workflows/shfmt/badge.svg?branch=v2.0.0) | +| main | ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg?branch=main) | ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg?branch=main) | ![shfmt](https://github.com/jidicula/clang-format-action/workflows/shfmt/badge.svg?branch=main) | +| dev | ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg?branch=dev) | ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg?branch=dev) | ![shfmt](https://github.com/jidicula/clang-format-action/workflows/shfmt/badge.svg?branch=dev) | + ![shellcheck](https://github.com/jidicula/clang-format-action/workflows/shellcheck/badge.svg) ![Docker Image CI](https://github.com/jidicula/clang-format-action/workflows/Docker%20Image%20CI/badge.svg) # clang-format-action GitHub Action for clang-format @@ -33,7 +39,7 @@ To use this action, create a `.github/workflows/clang-format-check.yml` in your ``` name: clang-format Check -on: [push] +on: [push, PR] jobs: formatting-check: name: Formatting Check @@ -41,5 +47,5 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run clang-format style check for C/C++ programs. - uses: jidicula/clang-format-action@v1.1.2 + uses: jidicula/clang-format-action@v2.0.0 ```