Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Security` in case of vulnerabilities

## [1.0.1] - 2025-02-09

### Added

- notice the commit URL

## [1.0.0] - 2025-02-01

- This GitHub Action automates PHPCS formatting across your project, ensuring consistent code styling by creating a new branch for review when necessary. It simplifies integrating PHPCS/PHPCBF into your workflow.
Expand All @@ -32,5 +38,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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.0...HEAD?w=1
[Unreleased]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.1...HEAD?w=1
[1.0.1]: https://github.com/WorkOfStan/phpcs-fix/compare/v1.0.0...v1.0.1?w=1
[1.0.0]: https://github.com/WorkOfStan/phpcs-fix/releases/tag/v1.0.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This action can either commit changes directly to the current branch or create a
- **Configurable:** Adjust extensions, ignore and standard parameters of phpcs. Adjust PHP version, or commit-message.
- **Caching:** Cache `vendor/` (for a unique combination of php-version and composer.json) after a successful run in order to speed up further runs.
- **GitHub Action Chain:** Either leave this GitHub Action non-blocking or set `stop-on-manual-fix` according to your automation process needs.
- **Direct link to a new commit:** A URL to the new commit is displayed as a notice to allow for a quick check of what's been changed.

## Usage

Expand Down
10 changes: 6 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ runs:
MORE_ISSUES=false
vendor/bin/phpcbf --extensions="${{ inputs.extensions }}" . --standard="${{ env.USE_STANDARD }}" --ignore="${{ inputs.ignore }}" || PHPCBF_EXIT_CODE=$?
if [ ${PHPCBF_EXIT_CODE} -ne 0 ]; then
echo "::notice title=phpcbf wasn't idle::Non-zero code exit of phpcbf = ${PHPCBF_EXIT_CODE} ... phpcbf wasn't idle"
echo "::notice title=PHPCBF wasn't idle::Non-zero code exit of phpcbf = ${PHPCBF_EXIT_CODE} (phpcbf wasn't idle)"

vendor/bin/phpcs --extensions="${{ inputs.extensions }}" . --standard="${{ env.USE_STANDARD }}" --ignore="${{ inputs.ignore }}" || MORE_ISSUES=true
# because of `||`, the previous command always exit 0
if [ "${MORE_ISSUES}" = "true" ]; then
echo "::warning title=Some phpcs issues remained.::Some phpcs issues remained. Manual fix necessary."
echo "::warning title=Some PHPCS issues remained.::Some phpcs issues remained. Manual fix necessary."
fi
fi

Expand All @@ -138,7 +138,7 @@ runs:

# Check for fixable changes
if [ -z "$(git status --porcelain)" ]; then
echo "::warning title=No fixable errors were found by phpcbf::No fixable errors were found by phpcbf: Manual fix necessary. Compare to the PHP Code Sniffer section above."
echo "::warning title=No fixable errors were found by PHPCBF::No fixable errors were found by phpcbf: Manual fix necessary. Compare to the PHP Code Sniffer section above."
if [ "${{ inputs.stop-on-manual-fix }}" = "true" ]; then
# Indicates an error
exit 1
Expand Down Expand Up @@ -170,7 +170,9 @@ runs:
# Commit and push changes with custom message
git commit -m "${{ inputs.commit-message }} on $(date +'%Y-%m-%d %H:%M:%S') UTC"
git push origin "$BRANCH_NAME"
echo "::notice title=Commit added::$NOTICE_MESSAGE"
echo "::notice title=PHPCBF commit added::${NOTICE_MESSAGE}"
COMMIT_URL=${{ github.server_url }}/${{ github.repository }}/commit/$(git rev-parse HEAD)
echo "::notice title=View the PHPCBF commit::${COMMIT_URL}"

# Set branch name as output
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
Expand Down
Loading