Comments (10)
Let's give it a try:
on: [push]
name: Create PRs for php-cs-fixer fixups
jobs:
fix-cs:
name: Fix CS violations
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: docker://oskarstark/php-cs-fixer-ga:latest
- uses: peter-evans/create-pull-request@v2
id: cpr
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Apply php-cs-fixer changes as of ${{ github.sha }}
title: Fix coding standards in ${{ github.ref }}
branch: php-cs-fixer/${{ github.ref }}
assignees: ${{ github.actor }}
body: |
Please apply these changes on the ${{ github.ref }} branch to fix coding standard violations.
- uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.cpr.outputs.pr_number
continue-on-error: true # Will fail if not on PR
with:
msg: |
@${{ github.actor }} please apply the coding standard fixes from #${{ steps.cpr.outputs.pr_number }}
This will monitor all pushed commits. Whenever a commit violates CS,
- create a branch named
php-cs-fixer/
+ the name of the branch with the bogus commits - (force) push necessary changes there
- Open a PR, to merge that branch into the offending branch
- If the offending branch has a corresponding PR open, add a comment in it to point to the fixups
Only downside: If a branch or PR violates CS, the status checks will be green, regardless of whether a fix is necessary or not.
Update: I'll try to maintain an up-to-date version of this at https://gist.github.com/mpdude/ca93a185bcbf56eb7e341632ad4f8263
from php-cs-fixer-ga.
I guess this would be easy to achieve using https://github.com/peter-evans/create-pull-request
Might only need a example config
from php-cs-fixer-ga.
Totally I agree. This issue can be closed (it is opened from my corporate user account)
from php-cs-fixer-ga.
Not yet but you can run the docker command locally from the readme to fix the issues, so that you don’t need that dependency in your composer.json file
from php-cs-fixer-ga.
after using some other Github Actions as a 'end-user' it seems to me that a comment triggered action command would be best for this.
something like: when a comment is posted to a pull request which contains /fix-cs
let the action run, fix the code and push to this pull request.
inspiration can be taken from e.g. https://github.com/cirrus-actions/rebase which does that with a different command.
I have no experience with docker or authoring github actions, therefore won't tackle it myself in the next weeks/months though.
from php-cs-fixer-ga.
Nice idea
from php-cs-fixer-ga.
Nice idea
from php-cs-fixer-ga.
I have found this github action here that actually also fixes code style: https://github.com/christophrumpel/laravel-factories-reloaded/blob/master/.github/workflows/run-styles.yml and this blog article: https://stefanzweifel.io/posts/run-prettier-or-php-cs-fixer-with-github-actions/#run-php-cs-fixer
from php-cs-fixer-ga.
We are using something similar in the meantime
https://github.com/redaxo/redaxo/blob/master/.github/workflows/cs-fix.yml
from php-cs-fixer-ga.
TBH it does not feel right do add all the needed code to this repository.
@localheinz and me are using Stefan Zweifel’s GitHub Action to commit changed files afterwards. You can do so much more like using a dedicated bot 🤖 User etc.
from php-cs-fixer-ga.
Related Issues (20)
- Can we ignore some file or folders ? HOT 1
- Manifest for oskarstark/php-cs-fixer-ga:null HOT 11
- PHP 8.3 HOT 1
- Regression in 3.26.0 update HOT 2
- How to use stable/tagged versions? HOT 5
- Check only changed files in PR HOT 5
- ##[error]Docker run failed with exit code 1 HOT 3
- Versioning HOT 1
- Location of .php_cs HOT 9
- Integration with Prettier HOT 2
- Failure with 2.18.6 HOT 8
- 3.0.0-rc.1 failing tests HOT 1
- Look just on the pushed files HOT 3
- Finder.php error HOT 1
- Not working on ubuntu-22.04 HOT 5
- 3.9.0 released HOT 3
- Syntax issue on 3.14.2 HOT 1
- You must call one of in() or append() methods before iterating over a Finder HOT 5
- Please add tag for v3.22.0 HOT 2
- Build images for other architectures HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-cs-fixer-ga.