Skip to content

Commit

Permalink
Use lint-actions-powershell
Browse files Browse the repository at this point in the history
- Use martincostello/lint-actions-powershell to lint PowerShell code embedded in GitHub Actions workflow files.
- Add filter and hide progress when checking out code.
  • Loading branch information
martincostello committed Feb 7, 2025
1 parent bd748ff commit 3d63d9d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Setup .NET SDK
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false
token: ${{ secrets.COSTELLOBOT_TOKEN }}

- name: Bump version
Expand Down Expand Up @@ -91,7 +93,7 @@ jobs:
git rev-parse --verify --quiet "remotes/origin/${branchName}" | Out-Null
if ($LASTEXITCODE -eq 0) {
Write-Host "Branch ${branchName} already exists."
Write-Output "Branch ${branchName} already exists."
exit 0
}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Initialize CodeQL
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Review dependencies
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
14 changes: 13 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ permissions:

env:
FORCE_COLOR: 3
POWERSHELL_YAML_VERSION: '0.4.12'
PSSCRIPTANALYZER_VERSION: '1.23.0'
TERM: xterm

jobs:
Expand All @@ -29,6 +31,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Add actionlint problem matcher
run: echo "::add-matcher::.github/actionlint-matcher.json"
Expand All @@ -45,6 +50,13 @@ jobs:
globs: |
**/*.md
- name: Lint PowerShell
- name: Lint PowerShell in workflows
uses: martincostello/lint-actions-powershell@5942e3350ee5bd8f8933cec4e1185d13f0ea688f # v1.0.0
with:
powershell-yaml-version: ${{ env.POWERSHELL_YAML_VERSION }}
psscriptanalyzer-version: ${{ env.PSSCRIPTANALYZER_VERSION }}
treat-warnings-as-errors: true

- name: Lint PowerShell scripts
shell: pwsh
run: Invoke-ScriptAnalyzer -Path . -Recurse -IncludeDefaultRules -ReportSummary -Severity @('Error','Warning') -EnableExit
2 changes: 2 additions & 0 deletions .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
persist-credentials: false
show-progress: false

- name: Run analysis
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false
token: ${{ secrets.COSTELLOBOT_TOKEN }}

- name: Get version
Expand Down

0 comments on commit 3d63d9d

Please sign in to comment.