Skip to content

Commit

Permalink
Refactor GitHub Actions for linting: streamline linter job and add de…
Browse files Browse the repository at this point in the history
…dicated lint-trigger workflow
  • Loading branch information
YummyBacon5 authored Nov 15, 2024
1 parent 375e347 commit 9e04939
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 30 deletions.
41 changes: 15 additions & 26 deletions .github/lint/action.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
name: linter
name: lint

on:
push:
paths:
- '**/*.ps1'
pull_request:
paths:
- '**/*.ps1'
runs:
using: "composite"
steps:
- uses: actions/checkout@v3

jobs:
lint:
name: PSScriptAnalyzer
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Run PSScriptAnalyzer
uses: microsoft/[email protected]
with:
path: .
recurse: true
output: results.sarif

- name: Run PSScriptAnalyzer
uses: microsoft/[email protected]
with:
path: .
recurse: true
output: results.sarif

- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
21 changes: 21 additions & 0 deletions .github/workflows/lint-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint-trigger

on:
workflow_dispatch:
push:
paths:
- "*.ps1"
pull_request:
paths:
- "*.ps1"

jobs:
lint:
runs-on: ubuntu-latest

permissions:
security-events: write

steps:
- uses: actions/checkout@v4
- uses: ./.github/lint
16 changes: 12 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ on:
- "*.ps1"

jobs:
# Add dependency on linter job
lint:
runs-on: ubuntu-latest

permissions:
security-events: write

steps:
- uses: actions/checkout@v4
- uses: ./.github/lint

ps1-to-exe:
runs-on: windows-latest

needs: lint

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- uses: ./.github/lint

- name: Install Ps2exe
shell: powershell
run: Install-Module ps2exe -force
Expand Down

0 comments on commit 9e04939

Please sign in to comment.