-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Commit
- Loading branch information
0 parents
commit c7c1ff2
Showing
17 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ReadMe.md | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[{*.yml,*.yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @erkenes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: erkenes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- | ||
package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Build Docker-Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: [ '*.*.*' ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
PHP_CS_FIXER_VERSION: '3.54.0' | ||
|
||
jobs: | ||
build-docker-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- | ||
name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- | ||
name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@a530e948adbeb357dbca95a7f8845d385edf4438 | ||
|
||
- | ||
name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- | ||
name: Extract Docker metadata | ||
id: meta-action | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- | ||
name: Build and push Docker image | ||
id: build-and-push-action | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
build-args: | | ||
PHP_CS_FIXER_VERSION=${{ env.PHP_CS_FIXER_VERSION }} | ||
push: true | ||
platforms: "linux/amd64,linux/arm64" | ||
tags: ${{ steps.meta-action.outputs.tags }} | ||
labels: ${{ steps.meta-action.outputs.labels }} | ||
sbom: false | ||
provenance: false | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Create new version | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "php8.2" | ||
- "php8.1" | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a | ||
with: | ||
app_id: ${{ secrets.TOKEN_APP_ID }} | ||
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }} | ||
|
||
- | ||
uses: google-github-actions/release-please-action@v4 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
target-branch: ${{ github.ref_name }} | ||
config-file: release-please-config.json | ||
manifest-file: .release-please-manifest.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
".": "0.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Docs: https://yamllint.readthedocs.io/en/stable/configuration.html | ||
extends: default | ||
|
||
rules: | ||
line-length: disable | ||
document-start: disable | ||
truthy: | ||
check-keys: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ARG PHP_CS_FIXER_VERSION | ||
ARG PHP_VERSION=8.3 | ||
|
||
FROM ghcr.io/php-cs-fixer/php-cs-fixer:${PHP_CS_FIXER_VERSION}-php${PHP_VERSION} | ||
|
||
LABEL "com.github.actions.name"="PHP-CS-Fixer" | ||
LABEL "com.github.actions.description"="Use PHP-CS-Fixer to fix your PHP code style" | ||
LABEL "com.github.actions.icon"="code" | ||
LABEL "com.github.actions.color"="blue" | ||
|
||
LABEL "repository"="http://github.com/erkenes/php-cs-fixer-action" | ||
LABEL "homepage"="http://github.com/actions" | ||
LABEL "maintainer"="Enes Erk <[email protected]>" | ||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Enes Erk | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# GitHub Action for PHP-CS-Fixer | ||
|
||
With this action you can run PHP-CS-Fixer in your GitHub Actions workflow. | ||
|
||
> NOTE: If you didn't create a `.php-cs-fixer.dist.php` file, do that first before adding this workflow. An example of this file created by the creators of PHP-CS-Fixer can be found [here](https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/.php-cs-fixer.dist.php). | ||
|
||
## Usage | ||
|
||
Define your GitHub workflow. | ||
|
||
```yaml | ||
# .github/workflows/php-cs-fixer.yml | ||
|
||
name: PHP-CS-Fixer | ||
|
||
on: | ||
pull_request: | ||
types: [review_requested, ready_for_review] | ||
|
||
jobs: | ||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
|
||
- | ||
name: Run PHP-CS-Fixer | ||
uses: erkenes/php-cs-fixer-action@main | ||
``` | ||
### Use auto-commit | ||
To commit the changes automatically to the branch of the pull request, you can use the following configuration: | ||
```yaml | ||
# .github/workflows/php-cs-fixer.yml | ||
|
||
jobs: | ||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
|
||
- | ||
name: Run PHP-CS-Fixer | ||
uses: erkenes/php-cs-fixer-action@main | ||
|
||
- | ||
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 | ||
with: | ||
commit_message: 'fix: Apply php-cs-fixer changes' | ||
``` | ||
## Local build for testing | ||
```bash | ||
docker build \ | ||
--build-arg "PHP_VERSION=8.3" \ | ||
--build-arg "PHP_CS_FIXER_VERSION=3.54.0" \ | ||
--tag "erkenes/php-cs-fixer-action:local" \ | ||
. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: 'PHP-CS-Fixer' | ||
|
||
description: 'Use PHP-CS-Fixer to fix your PHP code style.' | ||
author: 'Enes Erk <[email protected]>' | ||
|
||
runs: | ||
using: 'docker' | ||
# x-release-please-start-version | ||
image: 'docker://ghcr.io/erkenes/php-cs-fixer-action:php8.3-0.0.0' | ||
# x-release-please-end | ||
|
||
branding: | ||
icon: 'code' | ||
color: 'blue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh -l | ||
|
||
set -e | ||
php -v | ||
|
||
/usr/local/bin/php-cs-fixer --version | ||
/usr/local/bin/php-cs-fixer fix $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"packages": { | ||
".": { | ||
"component": "php8.3", | ||
"include-component-in-tag": true, | ||
"release-type": "simple", | ||
"include-v-in-tag": false, | ||
"draft": false, | ||
"prerelease": false, | ||
"bumpMinorPreMajor": false, | ||
"bumpPatchForMinorPreMajor": false, | ||
"changelogPath": "CHANGELOG.md", | ||
"versioning": "default", | ||
"extra-files": [ | ||
"action.yml" | ||
] | ||
} | ||
} | ||
} |