Skip to content

Commit f1d2706

Browse files
authored
fix: don't trigger a GitHub Action by a Tag (#13)
### 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).)
1 parent 9f9766b commit f1d2706

File tree

5 files changed

+42
-16
lines changed

5 files changed

+42
-16
lines changed

.github/workflows/phpcs-phpcbf.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
22
name: Phpcs-fix
3-
on: [pull_request, push]
3+
4+
on:
5+
push:
6+
branches-ignore:
7+
# notest branches to ignore testing of partial online commits
8+
- "notest/**"
9+
10+
pull_request:
11+
branches-ignore:
12+
# notest branches to ignore testing of partial online commits
13+
- "notest/**"
414

515
permissions:
616
contents: write
@@ -12,8 +22,8 @@ jobs:
1222
timeout-minutes: 10
1323
steps:
1424
- name: Invoke the PHPCS check and PHPCBF fix
15-
# Use the latest commit in the main branch.
16-
uses: WorkOfStan/phpcs-fix@main
25+
# Use the latest minor version within the current major version.
26+
uses: WorkOfStan/phpcs-fix@v1
1727
with:
1828
commit-changes: true
1929
#debug: true

.github/workflows/polish-the-code.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ permissions:
2424
jobs:
2525
commit-check:
2626
runs-on: ubuntu-latest
27-
permissions: # use permissions because use of pr-comments
27+
# use permissions because pull-request comments are used
28+
permissions:
2829
contents: read
2930
pull-requests: write
3031
# Limit the running time
@@ -35,18 +36,15 @@ jobs:
3536
ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit
3637
fetch-depth: 0 # required for merge-base check
3738
persist-credentials: false
38-
- uses: commit-check/commit-check-action@v1
39+
- uses: commit-check/commit-check-action@v2
3940
env:
4041
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because use of pr-comments
4142
with:
4243
message: true
4344
# to accept dependabot/github_actions/*
44-
branch: false
45+
# branch: false # todo might not be necessary as "dependabot[bot]" author is ignored
4546
author-name: true
4647
author-email: true
47-
commit-signoff: false
48-
merge-base: false
49-
imperative: false
5048
job-summary: true
5149
pr-comments: ${{ github.event_name == 'pull_request' }}
5250

@@ -59,12 +57,12 @@ jobs:
5957
timeout-minutes: 10
6058
steps:
6159
- name: Invoke the Prettier fix
62-
uses: WorkOfStan/prettier-fix@v1.1.6.1
60+
uses: WorkOfStan/prettier-fix@v1
6361
with:
6462
commit-changes: ${{ github.event_name != 'schedule' }}
6563

6664
super-linter:
67-
needs: prettier-fix
68-
uses: WorkOfStan/seablast-actions/.github/workflows/linter.yml@v0.2.6
65+
needs: [prettier-fix, commit-check]
66+
uses: WorkOfStan/seablast-actions/.github/workflows/linter.yml@v0.2.7
6967
with:
7068
runs-on: "ubuntu-latest"

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
### `Security` in case of vulnerabilities
2121

22+
## [1.0.4] - 2025-10-23
23+
24+
fix: don't trigger a GitHub Action by a Tag
25+
26+
### Changed
27+
28+
- bump GitHub Action's versions
29+
- make the commit message compliant with Conventional Commits
30+
31+
### Fixed
32+
33+
- 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).)
34+
2235
## [1.0.3] - 2025-10-04
2336

24-
- feat: the default commit message made compliant with Conventional Commits
37+
feat: the default commit message made compliant with Conventional Commits
2538

2639
### Changed
2740

@@ -60,7 +73,8 @@ fix: Fix pull request issues
6073
- 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.)
6174
- Cached `vendor/` (for a unique combination of php-version and composer.json) after a successful run in order to speed up further runs.
6275

63-
[Unreleased]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.3...HEAD?w=1
76+
[Unreleased]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.4...HEAD?w=1
77+
[1.0.4]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.3...v1.0.4?w=1
6478
[1.0.3]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.2...v1.0.3?w=1
6579
[1.0.2]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.1...v1.0.2?w=1
6680
[1.0.1]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.0...v1.0.1?w=1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ permissions:
3838
| Input | Description | Type | Default |
3939
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
4040
| `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` |
41-
| `commit-message` | Commit message to use if the action commits changes. | String | `"chore(phpcf): PHP Code Beautifier fixes applied automatically"` |
41+
| `commit-message` | Commit message to use if the action commits changes. | String | `"chore(phpcf): apply PHP Code Beautifier fixes automatically"` |
4242
| `debug` | Enable extra debug output (list of branches). | Boolean | `false` |
4343
| `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) |
4444
| `ignore` | Ignore files based on a comma-separated list of patterns matching files and/or directories. | String | `vendor/` |

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ inputs:
1919
commit-message:
2020
description: "Commit message for the changes"
2121
type: string
22-
default: "chore(phpcf): PHP Code Beautifier fixes applied automatically"
22+
default: "chore(phpcf): apply PHP Code Beautifier fixes automatically"
2323
debug:
2424
description: "Enable extra debug output"
2525
type: boolean
@@ -63,6 +63,10 @@ outputs:
6363
runs:
6464
using: "composite"
6565
steps:
66+
- name: Display version
67+
run: echo "phpcs-fix::v1.0.4 running"
68+
shell: bash
69+
6670
- name: Checkout code
6771
uses: actions/checkout@v5
6872
with:

0 commit comments

Comments
 (0)