Skip to content
Draft
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
33 changes: 29 additions & 4 deletions .github/workflows/__call-common-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
name: common lint (called)
permissions:
contents: read
pull-requests: read

on:
pull_request:
Expand All @@ -15,11 +16,19 @@ on:
- synchronize
- reopened
workflow_call:
inputs:
actionlint_config:
required: false
type: string
runner:
required: false
type: string
default: "[ubuntu-latest]"

jobs:
lint:
name: Common Lint
runs-on: ubuntu-latest
runs-on: ${{ (inputs && inputs.runner && fromJson(inputs.runner)) || 'ubuntu-latest' }}
env:
CLANG_FORMAT_VERSION: 20
steps:
Expand Down Expand Up @@ -69,8 +78,8 @@ jobs:

for name in "${!files[@]}"; do
if [ ! -f "${name}.json" ]; then
echo "Downloading ${name}.json"
url="${files[$name]}"
echo "Downloading ${name}.json from ${url}"
curl \
-fsSL \
--retry 3 \
Expand Down Expand Up @@ -106,15 +115,22 @@ jobs:
- name: Install actionlint
id: get_actionlint
shell: bash
env:
ACTIONLINT_CONFIG: ${{ inputs.actionlint_config }}
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)

if [ ! -f ".github/actionlint.yml" ]; then
if [ -n "${ACTIONLINT_CONFIG}" ]; then
mkdir -p .github
printf "%s" "${ACTIONLINT_CONFIG}" > .github/actionlint.yml
elif [ ! -f ".github/actionlint.yml" ]; then
url="https://raw.githubusercontent.com/LizardByte/.github/master/.github/actionlint.yml"
echo "Downloading ${url} with curl"
curl \
-fsSL \
--retry 3 \
-o ".github/actionlint.yml" \
"https://raw.githubusercontent.com/LizardByte/.github/master/.github/actionlint.yml"
${url}
fi

- name: Replace shell
Expand Down Expand Up @@ -354,6 +370,15 @@ jobs:
shell: pwsh
run: |
# PSScriptAnalyzer is already installed on GitHub runners
if ($env:RUNNER_NAME -notlike 'GitHub Actions*') {
$repo = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
if (-not $repo) {
Register-PSRepository -Default -InstallationPolicy Trusted
} else {
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
}
Install-Module -Name PSScriptAnalyzer -Force
}

# To see a list of available rules, run the following command:
# Get-ScriptAnalyzerRule | Format-List
Expand Down