{"id":13474123,"url":"https://github.com/OskarStark/php-cs-fixer-ga","last_synced_at":"2025-03-26T21:30:28.832Z","repository":{"id":36274131,"uuid":"163490763","full_name":"OskarStark/php-cs-fixer-ga","owner":"OskarStark","description":"GithubAction for PHP-CS-Fixer","archived":false,"fork":false,"pushed_at":"2024-05-29T00:44:31.000Z","size":99,"stargazers_count":180,"open_issues_count":3,"forks_count":32,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-29T14:57:40.854Z","etag":null,"topics":["github-actions","php","php-cs-fixer"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OskarStark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["OskarStark"]}},"created_at":"2018-12-29T08:02:46.000Z","updated_at":"2024-06-15T21:33:29.132Z","dependencies_parsed_at":"2023-09-27T01:21:09.868Z","dependency_job_id":"e53be8e0-9d61-4f62-b0e9-3e3dc580e785","html_url":"https://github.com/OskarStark/php-cs-fixer-ga","commit_stats":{"total_commits":105,"total_committers":19,"mean_commits":5.526315789473684,"dds":"0.21904761904761905","last_synced_commit":"717fa49729a13684a8880a0d0598fe015b6dbacd"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OskarStark%2Fphp-cs-fixer-ga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OskarStark%2Fphp-cs-fixer-ga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OskarStark%2Fphp-cs-fixer-ga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OskarStark%2Fphp-cs-fixer-ga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OskarStark","download_url":"https://codeload.github.com/OskarStark/php-cs-fixer-ga/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222169239,"owners_count":16942668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","php","php-cs-fixer"],"created_at":"2024-07-31T16:01:09.695Z","updated_at":"2024-10-30T05:30:31.232Z","avatar_url":"https://github.com/OskarStark.png","language":"Dockerfile","funding_links":["https://github.com/sponsors/OskarStark"],"categories":["Community Resources","Dockerfile","Uncategorized"],"sub_categories":["Testing and Linting","Static Analysis","Uncategorized"],"readme":"# GitHub Action for PHP-CS-Fixer\n\n\u003e 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).\n\n## Usage\n\nYou can use it as a GitHub Action like this:\n\n```yaml\n# .github/workflows/lint.yml\n\non: [push, pull_request]\nname: Main\njobs:\n  php-cs-fixer:\n    name: PHP-CS-Fixer\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v3\n    - name: PHP-CS-Fixer\n      uses: docker://oskarstark/php-cs-fixer-ga\n```\n\n_To use a custom config, e.g. `--diff` and `--dry-run` options:_\n\n```diff\n# .github/workflows/lint.yml\n\non: [push, pull_request]\nname: Main\njobs:\n  php-cs-fixer:\n    name: PHP-CS-Fixer\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v3\n    - name: PHP-CS-Fixer\n      uses: docker://oskarstark/php-cs-fixer-ga\n+     with:\n+       args: --config=.project.php_cs --diff --dry-run\n```\n\n## Usage with cache\n\nAdd `.php-cs-fixer.cache` to `.gitignore`, then:\n\n```\non: [push, pull_request]\nname: Main\njobs:\n  php-cs-fixer:\n    name: PHP-CS-Fixer\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: actions/cache@v3\n        with:\n          path: .php-cs-fixer.cache\n          key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.sha }}\n          restore-keys: |\n            ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-\n\n      - name: PHP-CS-Fixer\n        uses: docker://oskarstark/php-cs-fixer-ga\n```\n\n**You can copy/paste the `.github/` folder (under `examples/`) to your project and that's all!**\n\n## Usage with only changed files\n\nIt is also possible to run PHP-CS-Fixer just on your changed files. To achieve this, you can use the [`tj-actions/changed-files`](https://github.com/tj-actions/changed-files) action to retrieve the changed files and subsequently use the result to create extra arguments with `---path-mode=intersection`.\n\n```\non: [push, pull_request]\nname: Main\njobs:\n  php-cs-fixer:\n    name: PHP-CS-Fixer\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n\n      - name: Get changed files\n        id: changed-files\n        uses: tj-actions/changed-files@v38\n\n      - name: Get extra arguments for PHP-CS-Fixer\n        id: phpcs-intersection\n        run: |\n          CHANGED_FILES=$(echo \"${{ steps.changed-files.outputs.all_changed_files }}\" | tr ' ' '\\n')\n          if ! echo \"${CHANGED_FILES}\" | grep -qE \"^(\\\\.php-cs-fixer(\\\\.dist)?\\\\.php|composer\\\\.lock)$\"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\\n--\\n%s' \"${CHANGED_FILES}\"); else EXTRA_ARGS=''; fi\n          echo \"PHPCS_EXTRA_ARGS\u003c\u003cEOF\" \u003e\u003e $GITHUB_ENV\n          echo \"$EXTRA_ARGS\" \u003e\u003e $GITHUB_ENV\n          echo \"EOF\" \u003e\u003e $GITHUB_ENV\n\n      - name: PHP-CS-Fixer\n        uses: docker://oskarstark/php-cs-fixer-ga\n        with:\n          args: --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${{ env.PHPCS_EXTRA_ARGS }}\"\n```\n\n## Docker\n\nA Docker image is built automatically and located here:\nhttps://hub.docker.com/r/oskarstark/php-cs-fixer-ga\n\nYou can run it in any given directory like this:\n\n```bash\ndocker run --rm -it -w=/app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest\n```\n\n## A picture is worth a thousand words\n\nYou can find a working and not working PR here:\nhttps://github.com/OskarStark/test-php-cs-fixer-ga/pulls\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOskarStark%2Fphp-cs-fixer-ga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOskarStark%2Fphp-cs-fixer-ga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOskarStark%2Fphp-cs-fixer-ga/lists"}