-
Notifications
You must be signed in to change notification settings - Fork 88
Allow to work on pull_request and master branch #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This isn't really possible because -as for the on: [push, pull_request]
- name: Prettier Action on master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: creyD/prettier_action@v1.0
with:
prettier_options: "--write {**/*,*}.{js,html,json,md,yml,css,scss}"
branch: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} The branch SHOULD be filled with master automatically if it's the on push event. |
I'm already using the on:
pull_request:
types: [opened, synchronize]
push:
branches:
- master Which works great. I think I'm not clear on what I would love to have. I would love that the GitHub Action would work without specifying the branch. Or where it would work for both a PR and for a normal push. Maybe this works? on:
pull_request:
types: [opened, synchronize]
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: Prettier Action on master
uses: creyD/prettier_action@v1.0
with:
prettier_options: "--write {**/*,*}.{js,html,json,md,yml,css,scss}"
branch: ${{ github.head_ref || github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Note the branch name: |
I think you could do this with an if statement in your code. |
Thanks, will try! |
Not sure if this is possible, but it would be nice to have only one step instead of these two:
Somehow it would be nice to not have to specify a branch. That is automatically would know if it's a PR or if it's just a push. If it's not available in your app than we could do something like this:
The text was updated successfully, but these errors were encountered: