From e656ce9d96a2891c7518c710caef8e53b8127815 Mon Sep 17 00:00:00 2001 From: Bret Fisher Date: Sun, 5 Mar 2023 18:30:27 -0500 Subject: [PATCH] fixes and adding gha concurrency --- .../workflows/call-local-super-linter.yaml | 5 ++++ README.md | 30 ++++++++++++------- templates/call-super-linter.yaml | 25 ++++++++++------ 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/.github/workflows/call-local-super-linter.yaml b/.github/workflows/call-local-super-linter.yaml index c5f89b7..df889c2 100644 --- a/.github/workflows/call-local-super-linter.yaml +++ b/.github/workflows/call-local-super-linter.yaml @@ -12,6 +12,11 @@ on: pull_request: +# cancel any previously-started, yet still active runs of this workflow on the same branch +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: call-super-linter: diff --git a/README.md b/README.md index ede6d88..00a9a62 100644 --- a/README.md +++ b/README.md @@ -24,35 +24,42 @@ The GitHub [Super-Linter](https://github.com/marketplace/actions/super-linter) p name: Lint Code Base on: - + + # run anytime a PR is merged to main or a direct push to main push: branches: [main] - + + # run on any push to a PR branch pull_request: +# cancel any previously-started, yet still active runs of this workflow on the same branch +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: call-super-linter: name: Call Super-Linter - + permissions: contents: read # clone the repo to lint - statuses: write #read/write to repo custom statuses + statuses: write # read/write to repo custom statuses ### use Reusable Workflows to call my workflow remotely ### https://docs.github.com/en/actions/learn-github-actions/reusing-workflows ### you can also call workflows from inside the same repo via file path - #FIXME: customize uri to point to your own linter repository + # FIXME: customize uri to point to your own reusable linter repository uses: bretfisher/super-linter-workflow/.github/workflows/reusable-super-linter.yaml@main - + ### Optional settings examples - + # with: ### For a DevOps-focused repository. Prevents some code-language linters from running ### defaults to false # devops-only: false - + ### A regex to exclude files from linting ### defaults to empty # filter-regex-exclude: html/.* @@ -64,12 +71,14 @@ Option 1: Use [nektos/act](https://github.com/nektos/act) to run an existing Git Option 2: Use Docker to [run the Super-Linter image directly](https://github.com/github/super-linter/blob/main/docs/run-linter-locally.md). -## This repository is part of my example repos on GitHub Actions +Option 3: Pick the linter you want to run from Super-Linter, then install it locally to run manually. If you have a linter config, be sure to point the linter to `.github/linters/*`, and also realize that super-linter has default linter configs, that may change the linters behavior inside super-linter, with [templates listed here](https://github.com/github/super-linter/tree/main/TEMPLATES). + +## This repository is part of my example DevOps repos on GitHub Actions - [bretfisher/github-actions-templates](https://github.com/BretFisher/github-actions-templates) - Main repository - (you are here) [bretfisher/super-linter-workflow](https://github.com/BretFisher/super-linter-workflow) - Reusable linter workflow - [bretfisher/docker-build-workflow](https://github.com/BretFisher/docker-build-workflow)- Reusable docker build workflow -- [bretfisher/allhands22](https://github.com/BretFisher/github-actions-templates) - Step by step example of a Docker workflow +- [bretfisher/docker-ci-automation](https://github.com/BretFisher/docker-ci-automation) - Step by step video and example of a Docker CI workflow - [My full list of container examples and tools](https://github.com/bretfisher) ## 🎉🎉🎉 Join my container DevOps community 🎉🎉🎉 @@ -77,4 +86,3 @@ Option 2: Use Docker to [run the Super-Linter image directly](https://github.com - [My "Vital DevOps" Discord server](https://devops.fan) - [My weekly YouTube Live show](https://bret.live) - [My courses and coupons](https://www.bretfisher.com/courses) -Option 3: Pick the linter you want to run from Super-Linter, then install it locally to run manually. If you have a linter config, be sure to point the linter to `.github/linters/*`, and also realize that super-linter has default linter configs, that may change the linters behavior inside super-linter, with [templates listed here](https://github.com/github/super-linter/tree/main/TEMPLATES). diff --git a/templates/call-super-linter.yaml b/templates/call-super-linter.yaml index dc57e78..a43152a 100644 --- a/templates/call-super-linter.yaml +++ b/templates/call-super-linter.yaml @@ -3,35 +3,42 @@ name: Lint Code Base on: - + + # run anytime a PR is merged to main or a direct push to main push: branches: [main] - + + # run on any push to a PR branch pull_request: +# cancel any previously-started, yet still active runs of this workflow on the same branch +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: call-super-linter: name: Call Super-Linter - + permissions: contents: read # clone the repo to lint - statuses: write #read/write to repo custom statuses + statuses: write # read/write to repo custom statuses ### use Reusable Workflows to call my workflow remotely ### https://docs.github.com/en/actions/learn-github-actions/reusing-workflows ### you can also call workflows from inside the same repo via file path - #FIXME: customize uri to point to your own forked super-linter repository + # FIXME: customize uri to point to your own reusable linter repository uses: bretfisher/super-linter-workflow/.github/workflows/reusable-super-linter.yaml@main - + ### Optional settings examples - + # with: ### For a DevOps-focused repository. Prevents some code-language linters from running ### defaults to false # devops-only: false - + ### A regex to exclude files from linting ### defaults to empty - # filter-regex-exclude: html/.* + # filter-regex-exclude: html/.* \ No newline at end of file