diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index b089569..372f857 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -7,21 +7,7 @@ on: push: branches: - main - paths-ignore: - - '.github/dependabot.yml' - - '.github/pull_request_template.md' - - '.github/release.yml' - - '.github/workflows/label-checker.yml' - - '.github/workflows/task-list-checker.yml' - - '**.md' pull_request: - paths-ignore: - - '.github/dependabot.yml' - - '.github/pull_request_template.md' - - '.github/release.yml' - - '.github/workflows/label-checker.yml' - - '.github/workflows/task-list-checker.yml' - - '**.md' workflow_dispatch: inputs: {} @@ -42,9 +28,25 @@ defaults: shell: bash jobs: - go-lint: # NOTE: for Branch protection rule `Status checks that are required.` - name: Run golangci-lint - runs-on: ubuntu-latest # ref. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + paths-ignore: + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.paths-ignore.outputs.skip }} + steps: + - uses: kunitsucom/github-actions-paths-ignore-alternative@main + id: paths-ignore + with: + paths-ignore: |- + # substrings of file paths to ignore written in regular expressions + ^.github/dependabot.yml$ + ^.github/pull_request_template.md$ + ^.github/release.yml$ + ^.github/workflows/label-checker.yml$ + ^.github/workflows/task-list-checker.yml$ + go-lint: + runs-on: ubuntu-latest + needs: paths-ignore + if: ${{ needs.paths-ignore.outputs.skip != 'true' }} steps: - uses: actions/checkout@v4 - name: DEBUG diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index bcdad1d..4ee5350 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -7,21 +7,7 @@ on: push: branches: - main - paths-ignore: - - '.github/dependabot.yml' - - '.github/pull_request_template.md' - - '.github/release.yml' - - '.github/workflows/label-checker.yml' - - '.github/workflows/task-list-checker.yml' - - '**.md' pull_request: - paths-ignore: - - '.github/dependabot.yml' - - '.github/pull_request_template.md' - - '.github/release.yml' - - '.github/workflows/label-checker.yml' - - '.github/workflows/task-list-checker.yml' - - '**.md' workflow_dispatch: inputs: {} @@ -44,9 +30,25 @@ defaults: shell: bash jobs: - go-test: # NOTE: for Branch protection rule `Status checks that are required.` - name: Run go test - runs-on: ubuntu-latest # ref. https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + paths-ignore: + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.paths-ignore.outputs.skip }} + steps: + - uses: kunitsucom/github-actions-paths-ignore-alternative@main + id: paths-ignore + with: + paths-ignore: |- + # substrings of file paths to ignore written in regular expressions + ^.github/dependabot.yml$ + ^.github/pull_request_template.md$ + ^.github/release.yml$ + ^.github/workflows/label-checker.yml$ + ^.github/workflows/task-list-checker.yml$ + go-test: + runs-on: ubuntu-latest + needs: paths-ignore + if: ${{ needs.paths-ignore.outputs.skip != 'true' }} steps: - uses: actions/checkout@v4 - name: DEBUG @@ -135,7 +137,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ${{ env.WORKDIR }}/coverage.txt - name: Move docker build cache (workaround) - if: always() + if: ${{ !cancelled() }} # ref. https://docs.github.com/en/actions/learn-github-actions/expressions#always run: | if [[ -d ${{ env.DOCKER_BUILD_CACHE_TO }} ]]; then rm -rf ${{ env.DOCKER_BUILD_CACHE_FROM }}