Comments (4)
This isn't really possible because -as for the GITHUB_TOKEN
-, my repository and therefore the Action can't access the issuing (your) repository. Even if you provide the event name, my action doesn't know where to push to. If you just only want to merge to the origin branch, then this should do the job -the on parameter is documented here:
on: [push, pull_request]
- name: Prettier Action on master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: creyD/[email protected]
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.
from prettier_action.
I'm already using the on
parameter like this:
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/[email protected]
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: ${{ github.head_ref || github.ref }}
.
from prettier_action.
I think you could do this with an if statement in your code. ${{ github.head_ref || github.ref }}
won't work, but if you implement this functionality with a if else statement, it should work!
from prettier_action.
Thanks, will try!
from prettier_action.
Related Issues (20)
- [BUG] Problem running prettier in workflow HOT 5
- [BUG] Doesn't fail on infer parser failed HOT 4
- [BUG] Shouldn't delete node_modules HOT 8
- [BUG] Actions Fails to install/use modules - Cannot find module '@prettier/plugin-php'
- [BUG] Cannot find module 'prettier-plugin-tailwindcss' HOT 11
- [BUG] `prettier` not installed correctly HOT 9
- [BUG] prettier: command not found HOT 3
- [BUG] Problem --writer HOT 4
- [BUG] Process completed with exit code 1 HOT 5
- [BUG] Example not working. HOT 4
- IDEA: Add push_options parameter HOT 3
- [BUG] Error: Process completed with exit code 1 when using prettier-php HOT 12
- [BUG] Code style issues found, can't reproduce locally HOT 2
- [FEATURE] Format only changed lines not the whole file HOT 1
- [BUG] Should work when package-lock.json is not versioned HOT 3
- [FEATURE] Don't log unchanged files
- [BUG] Dry run fails in spite of the fact that a line length does not exceed 80 chars. HOT 2
- What is status code 128? HOT 5
- Readme out of date
- [FEATURE] Print the `prettier` command to be executed before executing it
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 prettier_action.