From 9e04939d58339d391d375f573409149d77698b18 Mon Sep 17 00:00:00 2001 From: Yummy_Bacon5 <68166338+YummyBacon5@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:31:25 +0000 Subject: [PATCH] Refactor GitHub Actions for linting: streamline linter job and add dedicated lint-trigger workflow --- .github/lint/action.yml | 41 +++++++++++------------------- .github/workflows/lint-trigger.yml | 21 +++++++++++++++ .github/workflows/publish.yml | 16 +++++++++--- 3 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/lint-trigger.yml diff --git a/.github/lint/action.yml b/.github/lint/action.yml index 3b8694d..2ef2bc4 100644 --- a/.github/lint/action.yml +++ b/.github/lint/action.yml @@ -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/psscriptanalyzer-action@v1.1 + with: + path: . + recurse: true + output: results.sarif - - name: Run PSScriptAnalyzer - uses: microsoft/psscriptanalyzer-action@v1.1 - with: - path: . - recurse: true - output: results.sarif - - - name: Upload SARIF results file - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: results.sarif \ No newline at end of file + - name: Upload SARIF results file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif \ No newline at end of file diff --git a/.github/workflows/lint-trigger.yml b/.github/workflows/lint-trigger.yml new file mode 100644 index 0000000..eff2223 --- /dev/null +++ b/.github/workflows/lint-trigger.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3926aaa..704e73b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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