Skip to content

Commit 7862250

Browse files
SamErdeCopilot
andcommitted
🤖 ci(workflows): reduce redundant workflow runs
Limit push-triggered lint workflows to main, add manual dispatch where useful, and tighten workflow token permissions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1241307 commit 7862250

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

.github/workflows/GitGuardian.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
---
33
name: GitGuardian
44

5-
on: [push]
5+
on:
6+
push:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
611

712
jobs:
813
scanning:

.github/workflows/MegaLinter.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
---
44
name: MegaLinter
55

6-
# Trigger mega-linter at every push. Action will also be visible from Pull
7-
# Requests to main
6+
# Trigger MegaLinter for pull requests, then re-check the merged result on main.
87
on:
9-
# Comment this line to trigger action only on pull-requests
10-
# (not recommended if you don't pay for GH Actions)
118
push:
9+
branches:
10+
- main
1211

1312
pull_request:
1413
branches:
1514
- main
1615

16+
workflow_dispatch:
17+
1718
concurrency:
1819
group: ${{ github.ref }}-${{ github.workflow }}
1920
cancel-in-progress: true
@@ -26,11 +27,8 @@ jobs:
2627
name: MegaLinter
2728
runs-on: ubuntu-latest
2829

29-
# Give the default GITHUB_TOKEN write permission to commit and push, comment
30-
# issues & post new PR; remove the ones you do not need
3130
permissions:
3231
contents: read
33-
issues: read
3432
pull-requests: read
3533

3634
steps:
@@ -44,11 +42,8 @@ jobs:
4442
- name: Checkout Code
4543
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
4644
with:
47-
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
48-
49-
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
50-
# improve performance
51-
fetch-depth: 0
45+
# Pull requests need history for diff linting; main pushes validate all code.
46+
fetch-depth: ${{ github.event_name == 'pull_request' && '0' || '1' }}
5247

5348
# MegaLinter
5449
- name: MegaLinter

.github/workflows/PSScriptAnalyzer.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ name: PSScriptAnalyzer
66

77
on:
88
push:
9+
branches:
10+
- main
11+
workflow_dispatch:
912

1013
permissions:
1114
contents: read
1215

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
1320
jobs:
1421
build:
1522
permissions:

0 commit comments

Comments
 (0)