From a8d456dc888f890af9e63d328409c0f6751578a1 Mon Sep 17 00:00:00 2001 From: WorkOfStan Date: Sat, 4 Oct 2025 13:22:23 +0200 Subject: [PATCH 1/2] fix: Tags MUST NOT trigger the GitHub Action. --- .github/workflows/phpcs-phpcbf.yml | 12 +++++++++++- CHANGELOG.md | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs-phpcbf.yml b/.github/workflows/phpcs-phpcbf.yml index a5e3ea0..e1bdc0c 100644 --- a/.github/workflows/phpcs-phpcbf.yml +++ b/.github/workflows/phpcs-phpcbf.yml @@ -1,6 +1,16 @@ --- name: Phpcs-fix -on: [pull_request, push] + +on: + push: + branches-ignore: + # notest branches to ignore testing of partial online commits + - "notest/**" + + pull_request: + branches-ignore: + # notest branches to ignore testing of partial online commits + - "notest/**" permissions: contents: write diff --git a/CHANGELOG.md b/CHANGELOG.md index d9974aa..091286c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,11 +17,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` for any bugfixes +fix: Tags MUST NOT trigger the GitHub Action. + +### Fixed + +- Trigger changed to ignore tags. I.e. change of the original trigger `on: [pull_request, push]` which caught also tags. (When running on a tag, actions/checkout runs on refs/tags/vX.Y.Z, so you end up with a detached HEAD, and github.head_ref is empty (it only exists on pull_request).) + ### `Security` in case of vulnerabilities ## [1.0.3] - 2025-10-04 -- feat: the default commit message made compliant with Conventional Commits +feat: the default commit message made compliant with Conventional Commits ### Changed From 27073468efffc9287074cdab74d74136c9d09e51 Mon Sep 17 00:00:00 2001 From: WorkOfStan Date: Thu, 23 Oct 2025 00:55:51 +0200 Subject: [PATCH 2/2] chore: make the commit message compliant with Conventional Commits --- .github/workflows/phpcs-phpcbf.yml | 4 ++-- .github/workflows/polish-the-code.yml | 16 +++++++--------- CHANGELOG.md | 16 ++++++++++++---- README.md | 2 +- action.yml | 6 +++++- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/phpcs-phpcbf.yml b/.github/workflows/phpcs-phpcbf.yml index e1bdc0c..03993a3 100644 --- a/.github/workflows/phpcs-phpcbf.yml +++ b/.github/workflows/phpcs-phpcbf.yml @@ -22,8 +22,8 @@ jobs: timeout-minutes: 10 steps: - name: Invoke the PHPCS check and PHPCBF fix - # Use the latest commit in the main branch. - uses: WorkOfStan/phpcs-fix@main + # Use the latest minor version within the current major version. + uses: WorkOfStan/phpcs-fix@v1 with: commit-changes: true #debug: true diff --git a/.github/workflows/polish-the-code.yml b/.github/workflows/polish-the-code.yml index 6b85082..e15e279 100644 --- a/.github/workflows/polish-the-code.yml +++ b/.github/workflows/polish-the-code.yml @@ -24,7 +24,8 @@ permissions: jobs: commit-check: runs-on: ubuntu-latest - permissions: # use permissions because use of pr-comments + # use permissions because pull-request comments are used + permissions: contents: read pull-requests: write # Limit the running time @@ -35,18 +36,15 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit fetch-depth: 0 # required for merge-base check persist-credentials: false - - uses: commit-check/commit-check-action@v1 + - uses: commit-check/commit-check-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because use of pr-comments with: message: true # to accept dependabot/github_actions/* - branch: false + # branch: false # todo might not be necessary as "dependabot[bot]" author is ignored author-name: true author-email: true - commit-signoff: false - merge-base: false - imperative: false job-summary: true pr-comments: ${{ github.event_name == 'pull_request' }} @@ -59,12 +57,12 @@ jobs: timeout-minutes: 10 steps: - name: Invoke the Prettier fix - uses: WorkOfStan/prettier-fix@v1.1.6.1 + uses: WorkOfStan/prettier-fix@v1 with: commit-changes: ${{ github.event_name != 'schedule' }} super-linter: - needs: prettier-fix - uses: WorkOfStan/seablast-actions/.github/workflows/linter.yml@v0.2.6 + needs: [prettier-fix, commit-check] + uses: WorkOfStan/seablast-actions/.github/workflows/linter.yml@v0.2.7 with: runs-on: "ubuntu-latest" diff --git a/CHANGELOG.md b/CHANGELOG.md index 091286c..7974091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,14 +17,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` for any bugfixes -fix: Tags MUST NOT trigger the GitHub Action. +### `Security` in case of vulnerabilities + +## [1.0.4] - 2025-10-23 + +fix: don't trigger a GitHub Action by a Tag + +### Changed + +- bump GitHub Action's versions +- make the commit message compliant with Conventional Commits ### Fixed - Trigger changed to ignore tags. I.e. change of the original trigger `on: [pull_request, push]` which caught also tags. (When running on a tag, actions/checkout runs on refs/tags/vX.Y.Z, so you end up with a detached HEAD, and github.head_ref is empty (it only exists on pull_request).) -### `Security` in case of vulnerabilities - ## [1.0.3] - 2025-10-04 feat: the default commit message made compliant with Conventional Commits @@ -66,7 +73,8 @@ fix: Fix pull request issues - The new boolean input `stop-on-manual-fix` will cause the workflow to stop (fail) if manual fixes are necessary. (Also stops with an error if some manual fixes are required on top of automatic fixes.) - Cached `vendor/` (for a unique combination of php-version and composer.json) after a successful run in order to speed up further runs. -[Unreleased]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.3...HEAD?w=1 +[Unreleased]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.4...HEAD?w=1 +[1.0.4]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.3...v1.0.4?w=1 [1.0.3]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.2...v1.0.3?w=1 [1.0.2]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.1...v1.0.2?w=1 [1.0.1]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.0...v1.0.1?w=1 diff --git a/README.md b/README.md index df6814b..fa4dd50 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ permissions: | Input | Description | Type | Default | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `commit-changes` | If set to `true`, the action will commit changes to the current branch; otherwise a new branch is created for manual review. | Boolean | `false` | -| `commit-message` | Commit message to use if the action commits changes. | String | `"chore(phpcf): PHP Code Beautifier fixes applied automatically"` | +| `commit-message` | Commit message to use if the action commits changes. | String | `"chore(phpcf): apply PHP Code Beautifier fixes automatically"` | | `debug` | Enable extra debug output (list of branches). | Boolean | `false` | | `extensions` | Comma-delimited list of file extensions to be sniffed. Note: an empty value will disable checking. | String | `"php"` (defaults to PHP only; other file types must be specified) | | `ignore` | Ignore files based on a comma-separated list of patterns matching files and/or directories. | String | `vendor/` | diff --git a/action.yml b/action.yml index 41e828d..55c043d 100644 --- a/action.yml +++ b/action.yml @@ -19,7 +19,7 @@ inputs: commit-message: description: "Commit message for the changes" type: string - default: "chore(phpcf): PHP Code Beautifier fixes applied automatically" + default: "chore(phpcf): apply PHP Code Beautifier fixes automatically" debug: description: "Enable extra debug output" type: boolean @@ -63,6 +63,10 @@ outputs: runs: using: "composite" steps: + - name: Display version + run: echo "phpcs-fix::v1.0.4 running" + shell: bash + - name: Checkout code uses: actions/checkout@v5 with: