Skip to content

Commit

Permalink
Fix PHPStan install & Upgrade stale action (#2469)
Browse files Browse the repository at this point in the history
* Bump actions/stale from 7 to 8

Bumps [actions/stale](https://github.com/actions/stale) from 7 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](actions/stale@v7...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* trvy

* phpstan install

* chmod

* [MegaLinter] Apply linters fixes

* trvy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: nvuillam <nvuillam@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 25, 2023
1 parent 31da18a commit 5e57679
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
if: "github.event_name == 'schedule'"
steps:
- name: Mark issue stale
uses: actions/stale@v7
uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity.\nIt will be closed in 14 days if no further activity occurs.\nThank you for your contributions.\n\nIf you think this issue should stay open, please remove the `O: stale 🤖` label or comment on the issue."
Expand Down
2 changes: 2 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ CVE-2021-43565
CVE-2021-45960
CVE-2021-46143
CVE-2021-46828
CVE-2021-46877
CVE-2022-0235
CVE-2022-0778
CVE-2022-1271
CVE-2022-1304
CVE-2022-1471
CVE-2022-1996
CVE-2022-2097
CVE-2022-3510
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l

- Linter enhancements
- [phpcs](https://megalinter.io/latest/descriptors/php_phpcs/): Add regex in descriptor to be able to extract the number of found errors
- Use docker image to install phpstan

- Core
- Run CI linter jobs only on Pull requests to avoid doubling jobs
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest

FROM ghcr.io/assignuser/chktex-alpine:latest as chktex
FROM mrtazz/checkmake:latest as checkmake
FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan
FROM yoheimuta/protolint:latest as protolint
FROM golang:alpine as dustilock
RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0
Expand Down Expand Up @@ -312,6 +313,7 @@ COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checke
COPY --link --from=revive /usr/bin/revive /usr/bin/revive
COPY --link --from=chktex /usr/bin/chktex /usr/bin/
COPY --link --from=checkmake /checkmake /usr/bin/checkmake
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/
COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock
COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/
Expand Down Expand Up @@ -544,8 +546,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI


# phpstan installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpstan -g --trust-gpg-keys CF1A108D0E7AE720

# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
6 changes: 4 additions & 2 deletions flavors/cupcake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ FROM golang:1-alpine as revive
RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest

FROM mrtazz/checkmake:latest as checkmake
FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan
FROM zricethezav/gitleaks:v8.16.0 as gitleaks
FROM ghcr.io/terraform-linters/tflint:v0.45.0 as tflint
FROM tenable/terrascan:1.18.0 as terrascan
Expand Down Expand Up @@ -270,6 +271,7 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint
COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker
COPY --link --from=revive /usr/bin/revive /usr/bin/revive
COPY --link --from=checkmake /checkmake /usr/bin/checkmake
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/
COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/
COPY --link --from=terrascan /go/bin/terrascan /usr/bin/
Expand Down Expand Up @@ -396,8 +398,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI


# phpstan installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpstan -g --trust-gpg-keys CF1A108D0E7AE720

# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
6 changes: 4 additions & 2 deletions flavors/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FROM koalaman/shellcheck:stable as shellcheck
FROM mvdan/shfmt:latest-alpine as shfmt
FROM hadolint/hadolint:v2.12.0-alpine as hadolint
FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker
FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan
FROM yoheimuta/protolint:latest as protolint
FROM zricethezav/gitleaks:v8.16.0 as gitleaks
#FROM__END
Expand Down Expand Up @@ -220,6 +221,7 @@ COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck
COPY --link --from=shfmt /bin/shfmt /usr/bin/
COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint
COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker
COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/
COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/
#COPY__END
Expand Down Expand Up @@ -301,8 +303,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI


# phpstan installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpstan -g --trust-gpg-keys CF1A108D0E7AE720

# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan

# psalm installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5
Expand Down
8 changes: 4 additions & 4 deletions linters/php_phpstan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## @generated by .automation/build.py using descriptor files, please do not update manually ##
#############################################################################################
#FROM__START

FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan
#FROM__END

##################
Expand Down Expand Up @@ -127,7 +127,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \
#############################################################################################

#COPY__START

COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
#COPY__END

#############################################################################################
Expand All @@ -153,8 +153,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI
ENV PATH="/root/.composer/vendor/bin:$PATH"

# phpstan installation
RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpstan -g --trust-gpg-keys CF1A108D0E7AE720

# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
RUN chmod +x /usr/bin/phpstan

#OTHER__END

Expand Down
6 changes: 3 additions & 3 deletions megalinter/descriptors/php.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ linters:
- "phpstan analyse --no-progress --no-ansi mydir1/ mydir2/ myfile.php"
install:
dockerfile:
- |
RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpstan -g --trust-gpg-keys CF1A108D0E7AE720
ide:
- FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan
- COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan
- RUN chmod +x /usr/bin/phpstan
idea:
- name: PHPStan / Psalm / Generics
url: https://plugins.jetbrains.com/plugin/12754-phpstan--psalm--generics
Expand Down

0 comments on commit 5e57679

Please sign in to comment.