Compare commits

...

10 Commits

Author SHA1 Message Date
renovate[bot]
a52399cf74 chore(deps): update pre-commit hook astral-sh/ruff-pre-commit (v0.14.6 → v0.14.7) (#385)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 18:45:39 +02:00
renovate[bot]
803165db8f chore(deps): update docker/metadata-action action (v5.9.0 → v5.10.0) (#387)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 18:45:19 +02:00
renovate[bot]
d69ed9e999 chore(deps): update pre-commit hook astral-sh/uv-pre-commit (0.9.11 → 0.9.13) (#386)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 18:44:55 +02:00
renovate[bot]
8eea6f781b chore(deps): update pre-commit hook gitleaks/gitleaks (v8.29.1 → v8.30.0) (#388)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 18:44:21 +02:00
renovate[bot]
4889586a94 chore(deps): update python (3.11.14 → 3.14.0) (#382)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 09:12:42 +02:00
renovate[bot]
e02ca4d843 chore(deps): update shivammathur/setup-php action (2.35.5 → 2.36.0) (#383)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 09:10:48 +02:00
renovate[bot]
13ef0db9ba chore(deps): update oxsecurity/megalinter action (v9.1.0 → v9.2.0) (#381)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 09:10:23 +02:00
renovate[bot]
c366e99ee3 chore(deps)!: update node (22.21.1 → 24.11.1) (#380)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-01 07:50:44 +02:00
fbbb487332 fix(pr-lint): corepack detection, tweaks and yarn fix (#379) 2025-11-30 13:46:16 +02:00
abe24f8570 feat(ci): versioning change (#378)
* chore: remove bylines from actions

* feat: new daily release action

* chore(ci): ignore false positive in codeql, fix others

* fix: cr comments
2025-11-28 10:56:52 +02:00
16 changed files with 167 additions and 93 deletions

View File

@@ -15,3 +15,19 @@ paths-ignore:
# Use security and quality query suite # Use security and quality query suite
queries: queries:
- uses: security-and-quality - uses: security-and-quality
# Suppress specific false positives
# These findings have been manually reviewed and determined to be false positives
# with appropriate security controls in place
query-filters:
# docker-publish: Code injection in validated context
# False positive: User input is validated and sanitized before use
# - Only relative paths and trusted git URLs are allowed
# - Absolute paths and arbitrary URLs are rejected
# - Path traversal attempts are blocked
# - Custom contexts require explicit opt-in via use-custom-context: true
# - Wraps docker/build-push-action (trusted Docker-maintained action)
# - Action is designed for trusted workflows only (documented in action.yml)
- exclude:
id: js/actions/code-injection
kind: problem

View File

@@ -49,7 +49,7 @@ jobs:
- name: Extract metadata - name: Extract metadata
id: meta id: meta
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0 uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with: with:
images: ghcr.io/${{ github.repository_owner }}/actions images: ghcr.io/${{ github.repository_owner }}/actions
tags: | tags: |

View File

@@ -42,4 +42,5 @@ jobs:
with: with:
language: ${{ matrix.language }} language: ${{ matrix.language }}
queries: security-and-quality queries: security-and-quality
config-file: .github/codeql/codeql-config.yml
token: ${{ github.token }} token: ${{ github.token }}

View File

@@ -22,27 +22,28 @@ jobs:
steps: steps:
- uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e # v6-beta - uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e # v6-beta
- name: Create tag if necessary - name: Create daily release
uses: fregante/daily-version-action@fb1a60b7c4daf1410cd755e360ebec3901e58588 # v2.1.3
id: daily-version id: daily-version
with: run: |
prefix: v set -eu
- name: Create changelog text VERSION="v$(date '+%Y.%m.%d')"
if: steps.daily-version.outputs.created printf '%s\n' "version=$VERSION" >> "$GITHUB_OUTPUT"
id: changelog
uses: loopwerk/tag-changelog@941366edb8920e2071eae0449031830984b9f26e # v1.3.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/tag-changelog-config.js
- name: Create release # Check if release already exists
if: steps.daily-version.outputs.created if gh release view "$VERSION" >/dev/null 2>&1; then
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 printf '%s\n' "created=false" >> "$GITHUB_OUTPUT"
printf '%s\n' "Release $VERSION already exists - skipping"
exit 0
fi
# Create release with auto-generated changelog (also creates tag)
gh release create "$VERSION" \
--title "Release $VERSION" \
--generate-notes \
--target main
printf '%s\n' "created=true" >> "$GITHUB_OUTPUT"
printf '%s\n' "Created release $VERSION"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.daily-version.outputs.version }}
name: Release ${{ steps.daily-version.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}
allowUpdates: true

View File

@@ -68,8 +68,6 @@ jobs:
```bash ```bash
make check-version-refs make check-version-refs
``` ```
🤖 Auto-generated by version-maintenance workflow
branch: automated/version-update-${{ steps.version.outputs.major }} branch: automated/version-update-${{ steps.version.outputs.major }}
delete-branch: true delete-branch: true
labels: | labels: |
@@ -120,8 +118,6 @@ jobs:
\`\`\`bash \`\`\`bash
make check-version-refs make check-version-refs
\`\`\` \`\`\`
🤖 Auto-generated by version-maintenance workflow
`, `,
labels: ['maintenance', 'high-priority'] labels: ['maintenance', 'high-priority']
}); });

View File

@@ -14,7 +14,7 @@ repos:
types: [markdown, python, yaml] types: [markdown, python, yaml]
files: ^(docs/.*|README\.md|CONTRIBUTING\.md|CHANGELOG\.md|.*\.py|.*\.ya?ml)$ files: ^(docs/.*|README\.md|CONTRIBUTING\.md|CHANGELOG\.md|.*\.py|.*\.ya?ml)$
- repo: https://github.com/astral-sh/uv-pre-commit - repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.11 rev: 0.9.13
hooks: hooks:
- id: uv-lock - id: uv-lock
- id: uv-sync - id: uv-sync
@@ -55,7 +55,7 @@ repos:
- id: yamllint - id: yamllint
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.6 rev: v0.14.7
hooks: hooks:
# Run the linter with auto-fix # Run the linter with auto-fix
- id: ruff-check - id: ruff-check
@@ -96,6 +96,6 @@ repos:
- '--quiet' - '--quiet'
- repo: https://github.com/gitleaks/gitleaks - repo: https://github.com/gitleaks/gitleaks
rev: v8.29.1 rev: v8.30.0
hooks: hooks:
- id: gitleaks - id: gitleaks

View File

@@ -76,11 +76,7 @@ if ! git diff --quiet; then
git commit -m "chore: bump major version from $OLD_VERSION to $NEW_VERSION git commit -m "chore: bump major version from $OLD_VERSION to $NEW_VERSION
This commit updates all internal action references from $OLD_VERSION This commit updates all internal action references from $OLD_VERSION
to $NEW_VERSION. to $NEW_VERSION."
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
printf '%b' "${GREEN}✅ Committed version bump${NC}\n" printf '%b' "${GREEN}✅ Committed version bump${NC}\n"
else else

View File

@@ -95,7 +95,7 @@ runs:
find . -maxdepth 2 -name "action.yml" -path "*/action.yml" ! -path "./_*" ! -path "./.github/*" -exec grep -h "uses: ivuorinen/actions/" {} \; > "$temp_file" find . -maxdepth 2 -name "action.yml" -path "*/action.yml" ! -path "./_*" ! -path "./.github/*" -exec grep -h "uses: ivuorinen/actions/" {} \; > "$temp_file"
while IFS= read -r line; do while IFS= read -r line; do
current_sha=$(echo "$line" | grep -oE '@[a-f0-9]{40}' | sed 's/@//') current_sha=$(printf '%s' "$line" | grep -oE '@[a-f0-9]{40}' | sed 's/@//')
if [ "$current_sha" != "$TAG_SHA" ]; then if [ "$current_sha" != "$TAG_SHA" ]; then
echo "Found outdated reference: $current_sha (should be $TAG_SHA)" echo "Found outdated reference: $current_sha (should be $TAG_SHA)"
@@ -153,11 +153,7 @@ runs:
git commit -m "chore: update action references to $MAJOR_VERSION ($TAG_SHA)" \ git commit -m "chore: update action references to $MAJOR_VERSION ($TAG_SHA)" \
-m "" \ -m "" \
-m "This commit updates all internal action references to point to the latest" \ -m "This commit updates all internal action references to point to the latest" \
-m "$MAJOR_VERSION tag SHA." \ -m "$MAJOR_VERSION tag SHA."
-m "" \
-m "🤖 Generated with [Claude Code](https://claude.com/claude-code)" \
-m "" \
-m "Co-Authored-By: Claude <noreply@anthropic.com>"
commit_sha=$(git rev-parse HEAD) commit_sha=$(git rev-parse HEAD)
printf '%s\n' "sha=$commit_sha" >> "$GITHUB_OUTPUT" printf '%s\n' "sha=$commit_sha" >> "$GITHUB_OUTPUT"

View File

@@ -77,7 +77,7 @@ runs:
if: steps.check-files.outputs.files_found == 'true' if: steps.check-files.outputs.files_found == 'true'
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with: with:
python-version: '3.11' python-version: '3.14'
cache: 'pip' cache: 'pip'
- name: Install ansible-lint - name: Install ansible-lint

View File

@@ -183,7 +183,7 @@ runs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with: with:
node-version: '22' node-version: '24'
- name: Enable Corepack - name: Enable Corepack
shell: sh shell: sh

View File

@@ -112,7 +112,7 @@ runs:
dockerhub|github|both) dockerhub|github|both)
;; ;;
*) *)
echo "::error::Invalid registry value. Must be 'dockerhub', 'github', or 'both'" printf '%s\n' "::error::Invalid registry value. Must be 'dockerhub', 'github', or 'both'"
exit 1 exit 1
;; ;;
esac esac
@@ -120,7 +120,7 @@ runs:
# Validate Docker Hub credentials if needed # Validate Docker Hub credentials if needed
if [ "$INPUT_REGISTRY" = "dockerhub" ] || [ "$INPUT_REGISTRY" = "both" ]; then if [ "$INPUT_REGISTRY" = "dockerhub" ] || [ "$INPUT_REGISTRY" = "both" ]; then
if [ -z "$INPUT_DOCKERHUB_USERNAME" ] || [ -z "$INPUT_DOCKERHUB_TOKEN" ]; then if [ -z "$INPUT_DOCKERHUB_USERNAME" ] || [ -z "$INPUT_DOCKERHUB_TOKEN" ]; then
echo "::error::Docker Hub username and token are required when publishing to Docker Hub" printf '%s\n' "::error::Docker Hub username and token are required when publishing to Docker Hub"
exit 1 exit 1
fi fi
fi fi
@@ -129,46 +129,77 @@ runs:
if [ "$INPUT_REGISTRY" = "github" ] || [ "$INPUT_REGISTRY" = "both" ]; then if [ "$INPUT_REGISTRY" = "github" ] || [ "$INPUT_REGISTRY" = "both" ]; then
token="${INPUT_TOKEN:-${GITHUB_TOKEN:-}}" token="${INPUT_TOKEN:-${GITHUB_TOKEN:-}}"
if [ -z "$token" ]; then if [ -z "$token" ]; then
echo "::error::GitHub token is required when publishing to GitHub Packages" printf '%s\n' "::error::GitHub token is required when publishing to GitHub Packages"
exit 1 exit 1
fi fi
fi fi
# Validate context input for security # Validate context input for security
INPUT_CONTEXT="${INPUT_CONTEXT:-.}" INPUT_CONTEXT="${INPUT_CONTEXT:-.}"
case "$INPUT_CONTEXT" in case "$INPUT_CONTEXT" in
.|./*|*/*) .|./*|*/*)
# Relative paths are allowed # Relative paths are allowed
# Check for path traversal attempts
case "$INPUT_CONTEXT" in
*/../*|../*|*/..)
printf '%s\n' "::error::Context path contains path traversal: '$INPUT_CONTEXT'"
exit 1
;;
esac
;; ;;
/*) /*)
echo "::error::Context cannot be an absolute path: '$INPUT_CONTEXT'" printf '%s\n' "::error::Context cannot be an absolute path: '$INPUT_CONTEXT'"
echo "::error::Use relative paths (e.g., '.', './app') to prevent code injection" printf '%s\n' "::error::Use relative paths (e.g., '.', './app')"
exit 1 exit 1
;; ;;
*://*) git://*|git@*|https://*.git|https://github.com/*|https://gitlab.com/*)
echo "::warning::Context is a remote URL: '$INPUT_CONTEXT'" # Allow trusted git repository URLs
echo "::warning::Ensure this URL is from a trusted source to prevent code injection" printf '%s\n' "::notice::Using git repository URL for context"
;;
http://*|https://*)
printf '%s\n' "::error::Context cannot be an arbitrary HTTP URL: '$INPUT_CONTEXT'"
printf '%s\n' "::error::Only git repository URLs are allowed for remote contexts"
exit 1
;;
*)
printf '%s\n' "::error::Invalid context format: '$INPUT_CONTEXT'"
printf '%s\n' "::error::Must be a relative path or git repository URL"
exit 1
;; ;;
esac esac
# Validate dockerfile input for security # Validate dockerfile input for security
INPUT_DOCKERFILE="${INPUT_DOCKERFILE:-Dockerfile}" INPUT_DOCKERFILE="${INPUT_DOCKERFILE:-Dockerfile}"
case "$INPUT_DOCKERFILE" in case "$INPUT_DOCKERFILE" in
Dockerfile|*/Dockerfile|*.dockerfile|*/*.dockerfile) Dockerfile|*/Dockerfile|*.dockerfile|*/*.dockerfile)
# Common dockerfile patterns are allowed # Common dockerfile patterns are allowed
# Check for path traversal attempts
case "$INPUT_DOCKERFILE" in
*/../*|../*|*/..)
printf '%s\n' "::error::Dockerfile path contains path traversal: '$INPUT_DOCKERFILE'"
exit 1
;;
esac
;; ;;
/*) /*)
echo "::error::Dockerfile path cannot be absolute: '$INPUT_DOCKERFILE'" printf '%s\n' "::error::Dockerfile path cannot be absolute: '$INPUT_DOCKERFILE'"
echo "::error::Use relative paths (e.g., 'Dockerfile', './docker/Dockerfile')" printf '%s\n' "::error::Use relative paths (e.g., 'Dockerfile', './docker/Dockerfile')"
exit 1 exit 1
;; ;;
*://*) *://*)
echo "::error::Dockerfile path cannot be a URL: '$INPUT_DOCKERFILE'" printf '%s\n' "::error::Dockerfile path cannot be a URL: '$INPUT_DOCKERFILE'"
exit 1
;;
*)
printf '%s\n' "::error::Invalid Dockerfile format: '$INPUT_DOCKERFILE'"
printf '%s\n' "::error::Must be 'Dockerfile', '*/Dockerfile', '*.dockerfile', or '*/*.dockerfile'"
exit 1 exit 1
;; ;;
esac esac
echo "Input validation completed successfully" printf '%s\n' "Input validation completed successfully"
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
@@ -223,14 +254,14 @@ runs:
# Output results # Output results
printf 'image-name=%s\n' "$base_name" >> "$GITHUB_OUTPUT" printf 'image-name=%s\n' "$base_name" >> "$GITHUB_OUTPUT"
{ {
echo 'tags<<EOF' printf '%s\n' 'tags<<EOF'
echo "$tags" printf '%s\n' "$tags"
echo 'EOF' printf '%s\n' 'EOF'
} >> "$GITHUB_OUTPUT" } >> "$GITHUB_OUTPUT"
echo "Image name: $base_name" printf 'Image name: %s\n' "$base_name"
echo "Tags:" printf '%s\n' "Tags:"
echo "$tags" printf '%s\n' "$tags"
- name: Login to Docker Hub - name: Login to Docker Hub
if: inputs.registry == 'dockerhub' || inputs.registry == 'both' if: inputs.registry == 'dockerhub' || inputs.registry == 'both'

View File

@@ -290,7 +290,7 @@ runs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with: with:
node-version: '22' node-version: '24'
- name: Enable Corepack - name: Enable Corepack
shell: sh shell: sh

View File

@@ -123,7 +123,7 @@ runs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with: with:
node-version: '22' node-version: '24'
- name: Enable Corepack - name: Enable Corepack
shell: sh shell: sh

View File

@@ -319,7 +319,7 @@ runs:
- name: Setup PHP - name: Setup PHP
id: setup-php id: setup-php
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5 uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with: with:
php-version: ${{ steps.detect-php-version.outputs.detected-version }} php-version: ${{ steps.detect-php-version.outputs.detected-version }}
extensions: ${{ inputs.extensions }} extensions: ${{ inputs.extensions }}

View File

@@ -54,7 +54,7 @@ runs:
uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e # v6-beta uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e # v6-beta
with: with:
token: ${{ inputs.token || github.token }} token: ${{ inputs.token || github.token }}
ref: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref_name }} ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false persist-credentials: false
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
@@ -74,6 +74,29 @@ runs:
if [ -f package.json ]; then if [ -f package.json ]; then
printf '%s\n' "found=true" >> "$GITHUB_OUTPUT" printf '%s\n' "found=true" >> "$GITHUB_OUTPUT"
# Check if packageManager field is set (for corepack)
if command -v jq >/dev/null 2>&1; then
has_package_manager=$(jq -r '.packageManager // empty' package.json 2>/dev/null || printf '')
if [ -n "$has_package_manager" ]; then
printf '%s\n' "has-package-manager=true" >> "$GITHUB_OUTPUT"
printf 'Found packageManager field: %s\n' "$has_package_manager"
else
printf '%s\n' "has-package-manager=false" >> "$GITHUB_OUTPUT"
fi
else
# Fallback: check with grep if jq not available
# Use robust pattern to verify non-empty value
if grep -q '"packageManager"[[:space:]]*:[[:space:]]*"[^"]\+"' package.json 2>/dev/null; then
printf '%s\n' "has-package-manager=true" >> "$GITHUB_OUTPUT"
printf '%s\n' "Found packageManager field in package.json"
else
printf '%s\n' "has-package-manager=false" >> "$GITHUB_OUTPUT"
fi
fi
else
# Explicitly set has-package-manager to false when package.json doesn't exist
printf '%s\n' "has-package-manager=false" >> "$GITHUB_OUTPUT"
fi fi
- name: Detect Package Manager - name: Detect Package Manager
@@ -101,28 +124,33 @@ runs:
if: steps.detect-node.outputs.found == 'true' if: steps.detect-node.outputs.found == 'true'
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with: with:
node-version: '22' node-version: '24'
- name: Enable Corepack - name: Enable Corepack
if: steps.detect-node.outputs.found == 'true' if: steps.detect-node.outputs.found == 'true' && steps.detect-node.outputs.has-package-manager == 'true'
shell: sh shell: sh
run: | run: |
set -eu set -eu
corepack enable corepack enable
printf '%s\n' "Corepack enabled - package manager will be installed automatically from package.json"
- name: Install Package Manager - name: Install Package Manager (Fallback)
if: steps.detect-node.outputs.found == 'true' if: steps.detect-node.outputs.found == 'true' && steps.detect-node.outputs.has-package-manager == 'false'
shell: sh shell: sh
env: env:
PACKAGE_MANAGER: ${{ steps.detect-pm.outputs.package-manager }} PACKAGE_MANAGER: ${{ steps.detect-pm.outputs.package-manager }}
run: | run: |
set -eu set -eu
printf 'No packageManager field found, using detected package manager: %s\n' "$PACKAGE_MANAGER"
case "$PACKAGE_MANAGER" in case "$PACKAGE_MANAGER" in
pnpm) pnpm)
corepack enable
corepack prepare pnpm@latest --activate corepack prepare pnpm@latest --activate
;; ;;
yarn) yarn)
corepack enable
corepack prepare yarn@stable --activate corepack prepare yarn@stable --activate
;; ;;
bun|npm) bun|npm)
@@ -161,9 +189,14 @@ runs:
pnpm install --frozen-lockfile pnpm install --frozen-lockfile
;; ;;
"yarn") "yarn")
if [ -f ".yarnrc.yml" ]; then # Detect Yarn version by checking actual version output
# Yarn 2+ (Berry) uses --immutable, Yarn 1.x (Classic) uses --frozen-lockfile
yarn_version=$(yarn --version 2>/dev/null || printf '1.0.0')
if printf '%s' "$yarn_version" | grep -q '^[2-9]'; then
# Yarn 2+ (Berry) - use --immutable
yarn install --immutable yarn install --immutable
else else
# Yarn 1.x (Classic) - use --frozen-lockfile
yarn install --frozen-lockfile yarn install --frozen-lockfile
fi fi
;; ;;
@@ -306,7 +339,7 @@ runs:
- name: Setup PHP - name: Setup PHP
if: steps.detect-php.outputs.found == 'true' if: steps.detect-php.outputs.found == 'true'
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5 uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
with: with:
php-version: ${{ steps.php-version.outputs.detected-version }} php-version: ${{ steps.php-version.outputs.detected-version }}
tools: composer tools: composer
@@ -323,7 +356,7 @@ runs:
set -eu set -eu
matcher_path=$(printf '%s' "$RUNNER_TOOL_CACHE/php.json" | tr -d '\n\r') matcher_path=$(printf '%s' "$RUNNER_TOOL_CACHE/php.json" | tr -d '\n\r')
echo "::add-matcher::$matcher_path" printf '%s\n' "::add-matcher::$matcher_path"
- name: Install PHP dependencies - name: Install PHP dependencies
if: steps.detect-php.outputs.found == 'true' if: steps.detect-php.outputs.found == 'true'
@@ -603,7 +636,7 @@ runs:
- name: MegaLinter - name: MegaLinter
# You can override MegaLinter flavor used to have faster performances # You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/latest/flavors/ # More info at https://megalinter.io/latest/flavors/
uses: oxsecurity/megalinter/flavors/cupcake@62c799d895af9bcbca5eacfebca29d527f125a57 # v9.1.0 uses: oxsecurity/megalinter/flavors/cupcake@55a59b24a441e0e1943080d4a512d827710d4a9d # v9.2.0
id: ml id: ml
# All available variables are described in documentation # All available variables are described in documentation
@@ -653,8 +686,8 @@ runs:
- name: Export Apply Fixes Variables - name: Export Apply Fixes Variables
shell: sh shell: sh
run: | run: |
echo "APPLY_FIXES_EVENT=pull_request" >> "$GITHUB_ENV" printf '%s\n' "APPLY_FIXES_EVENT=pull_request" >> "$GITHUB_ENV"
echo "APPLY_FIXES_MODE=commit" >> "$GITHUB_ENV" printf '%s\n' "APPLY_FIXES_MODE=commit" >> "$GITHUB_ENV"
# Upload MegaLinter artifacts # Upload MegaLinter artifacts
- name: Archive production artifacts - name: Archive production artifacts
@@ -729,13 +762,6 @@ runs:
- name: Prepare commit - name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true' if: env.APPLY_FIXES_IF_COMMIT == 'true'
shell: sh shell: sh
env:
BRANCH_REF: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref_name
}}
run: | run: |
set -eu set -eu
@@ -747,27 +773,38 @@ runs:
# This is necessary because MegaLinter may leave the repo in a detached HEAD state # This is necessary because MegaLinter may leave the repo in a detached HEAD state
current_branch=$(git rev-parse --abbrev-ref HEAD) current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" = "HEAD" ]; then if [ "$current_branch" = "HEAD" ]; then
echo "Repository is in detached HEAD state, checking out $BRANCH_REF" printf '%s\n' "Repository is in detached HEAD state"
# Validate branch reference to prevent command injection
if ! git check-ref-format --branch "$BRANCH_REF"; then # Get the branch name from git refs (safer than trusting event data)
echo "::error::Invalid branch reference format: $BRANCH_REF" # This finds the branch that points to the current commit
branch_ref=$(git for-each-ref --format='%(refname:short)' --points-at=HEAD 'refs/remotes/origin/*' | head -1 | sed 's|^origin/||')
if [ -z "$branch_ref" ]; then
printf '%s\n' "::error::Could not determine branch name from git refs"
exit 1 exit 1
fi fi
git checkout "$BRANCH_REF"
# Validate branch reference to prevent command injection
if ! git check-ref-format --branch "$branch_ref"; then
printf '%s\n' "::error::Invalid branch reference format: $branch_ref"
exit 1
fi
printf 'Checking out branch: %s\n' "$branch_ref"
git checkout "$branch_ref"
# Export for next step
printf '%s\n' "VALIDATED_BRANCH=$branch_ref" >> "$GITHUB_ENV"
else else
echo "Repository is on branch: $current_branch" printf 'Repository is on branch: %s\n' "$current_branch"
printf '%s\n' "VALIDATED_BRANCH=$current_branch" >> "$GITHUB_ENV"
fi fi
- name: Commit and push applied linter fixes - name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0 uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
if: env.APPLY_FIXES_IF_COMMIT == 'true' if: env.APPLY_FIXES_IF_COMMIT == 'true'
with: with:
branch: >- branch: ${{ env.VALIDATED_BRANCH }}
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
commit_message: 'style: apply linter fixes' commit_message: 'style: apply linter fixes'
commit_user_name: ${{ inputs.username }} commit_user_name: ${{ inputs.username }}
commit_user_email: ${{ inputs.email }} commit_user_email: ${{ inputs.email }}

View File

@@ -276,7 +276,7 @@ runs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with: with:
node-version: '22' node-version: '24'
- name: Enable Corepack - name: Enable Corepack
shell: sh shell: sh