Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github-actions: use concurrency: true if PRs #284

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
schedule:
- cron: '0 11 * * 6'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
analyze:
name: Analyze
Expand All @@ -17,16 +21,9 @@ jobs:
permissions:
# required for all workflows
security-events: write
# only required for workflows in private repositories
actions: write
contents: read

steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v3
with:
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@ on:
required: true

permissions:
# Required to stop running workflows
actions: write
packages: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-docker-images:
name: Build Docker Images
runs-on: ubuntu-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v3
Expand Down
36 changes: 3 additions & 33 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,16 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
# Required to stop running workflows
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
# Check if there any dirty change for go mod tidy
go-mod:
name: "Check go modules declaration"
runs-on: ubuntu-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Install Go
uses: actions/setup-go@v3
Expand Down Expand Up @@ -63,11 +58,6 @@ jobs:
runs-on: ubuntu-latest
needs: [golangci-lint, go-mod]
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -98,11 +88,6 @@ jobs:
name: "GolangCI-lint"
runs-on: ubuntu-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Install Go
uses: actions/setup-go@v3
Expand All @@ -122,11 +107,6 @@ jobs:
needs: [go-mod, compile-dryrun, golangci-lint] # run after golangci-lint action to not produce duplicated errors
runs-on: ubuntu-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -160,11 +140,6 @@ jobs:
needs: [go-mod, compile-dryrun, golangci-lint] # run after golangci-lint action to not produce duplicated errors
runs-on: windows-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -198,11 +173,6 @@ jobs:
needs: [go-mod, compile-dryrun, golangci-lint] # run after golangci-lint action to not produce duplicated errors
runs-on: macos-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v3
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
description: 'Release version'
required: true

permissions:
# Required to stop running workflows
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
release:
Expand All @@ -18,11 +18,6 @@ jobs:
packages: read
contents: write
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout
uses: actions/checkout@v3
Expand Down
27 changes: 3 additions & 24 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,16 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
# Required to stop running workflows
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
vulns:
name: Nancy scanner
continue-on-error: true
runs-on: ubuntu-latest
steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
uses: actions/checkout@v3
-
Expand All @@ -47,11 +42,6 @@ jobs:
pull-requests: read

steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
uses: actions/checkout@v3
-
Expand Down Expand Up @@ -79,15 +69,9 @@ jobs:
# contents: read
# security-events: write
# pull-requests: read
# actions: write
#
# steps:
# -
# name: Cancel previous workflows
# uses: styfle/[email protected]
# with:
# access_token: ${{ secrets.GITHUB_TOKEN }}
# -
# uses: actions/checkout@v3
# -
# name: Run Snyk to check for vulnerabilities
Expand All @@ -114,11 +98,6 @@ jobs:
pull-requests: read

steps:
-
name: Cancel previous workflows
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
-
uses: actions/checkout@v3
-
Expand Down
Loading