Skip to content

Commit 6602189

Browse files
authored
Merge pull request #88 from creyD/dev
Minor Feature & Bugfix Update
2 parents 661230a + 0bf5ce0 commit 6602189

File tree

4 files changed

+67
-64
lines changed

4 files changed

+67
-64
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: Bug report
33
about: Report a problem!
44
title: "[BUG]"
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**What exactly happened?**
1110
Steps to reproduce the behavior:
11+
1212
1. Go to '...'
1313
2. Click on '....'
1414
3. Scroll down to '....'
@@ -21,8 +21,8 @@ A clear and concise description of what you expected to happen.
2121
If applicable, add screenshots to help explain your problem.
2222

2323
**Where did you encounter the problem?**
24-
- OS: [e.g. iOS]
24+
2525
- Repo: [e.g. URL to your repository]
26-
- Version [e.g. 22]
26+
- Version [e.g. 22]
2727

2828
<!-- If you think you can help us with that, please note it here! -->

.github/ISSUE_TEMPLATE/feature_request.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ name: Feature request
33
about: Request a feature!
44
title: "[FEATURE]"
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**What would you like to change about the program?**
11-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10+
A clear and concise description of what the problem is.
1211

1312
**Why do you think this is a cool idea?**
1413
A clear and concise description of why your feature would improve the program.

README.md

+59-55
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
[![Contributors](https://img.shields.io/github/contributors-anon/creyD/prettier_action)](https://github.com/creyD/prettier_action/graphs/contributors)
88
[![Issues](https://img.shields.io/github/issues/creyD/prettier_action)](https://github.com/creyD/prettier_action/issues)
99

10-
1110
A GitHub action for styling files with [prettier](https://prettier.io).
1211

1312
## Usage
@@ -35,7 +34,9 @@ A GitHub action for styling files with [prettier](https://prettier.io).
3534
### Example Config
3635

3736
> Hint: if you still use the old naming convention or generally a different branch name, please replace the `main` in the following configurations.
37+
3838
#### Example 1 (run on push in branch main)
39+
3940
```yaml
4041
name: Continuous Integration
4142

@@ -44,27 +45,28 @@ on:
4445
pull_request:
4546
push:
4647
branches:
47-
- main
48+
- main
4849

4950
jobs:
5051
prettier:
5152
runs-on: ubuntu-latest
5253

5354
steps:
54-
- name: Checkout
55-
uses: actions/checkout@v2
56-
with:
57-
# Make sure the actual branch is checked out when running on pull requests
58-
ref: ${{ github.head_ref }}
59-
60-
- name: Prettify code
61-
uses: creyD/prettier_action@v4.1.1
62-
with:
63-
# This part is also where you can pass other options, for example:
64-
prettier_options: --write **/*.{js,md}
55+
- name: Checkout
56+
uses: actions/checkout@v2
57+
with:
58+
# Make sure the actual branch is checked out when running on pull requests
59+
ref: ${{ github.head_ref }}
60+
61+
- name: Prettify code
62+
uses: creyD/prettier_action@v4.2
63+
with:
64+
# This part is also where you can pass other options, for example:
65+
prettier_options: --write **/*.{js,md}
6566
```
6667
6768
#### Example 2 (using the only_changed or same_commit option on PR)
69+
6870
```yaml
6971
name: Continuous Integration
7072

@@ -77,23 +79,24 @@ jobs:
7779
runs-on: ubuntu-latest
7880

7981
steps:
80-
- name: Checkout
81-
uses: actions/checkout@v2
82-
with:
83-
# Make sure the actual branch is checked out when running on pull requests
84-
ref: ${{ github.head_ref }}
85-
# This is important to fetch the changes to the previous commit
86-
fetch-depth: 0
87-
88-
- name: Prettify code
89-
uses: creyD/prettier_action@v4.1.1
90-
with:
91-
# This part is also where you can pass other options, for example:
92-
prettier_options: --write **/*.{js,md}
93-
only_changed: True
82+
- name: Checkout
83+
uses: actions/checkout@v2
84+
with:
85+
# Make sure the actual branch is checked out when running on pull requests
86+
ref: ${{ github.head_ref }}
87+
# This is important to fetch the changes to the previous commit
88+
fetch-depth: 0
89+
90+
- name: Prettify code
91+
uses: creyD/prettier_action@v4.2
92+
with:
93+
# This part is also where you can pass other options, for example:
94+
prettier_options: --write **/*.{js,md}
95+
only_changed: True
9496
```
9597
9698
#### Example 3 (using a custom access token on PR)
99+
97100
```yaml
98101
name: Continuous Integration
99102

@@ -106,24 +109,25 @@ jobs:
106109
runs-on: ubuntu-latest
107110

108111
steps:
109-
- name: Checkout
110-
uses: actions/checkout@v2
111-
with:
112-
fetch-depth: 0
113-
ref: ${{ github.head_ref }}
114-
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
115-
persist-credentials: false
116-
117-
- name: Prettify code
118-
uses: creyD/prettier_action@v4.1
119-
with:
120-
prettier_options: --write **/*.{js,md}
121-
only_changed: True
122-
# Set your custom token
123-
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
112+
- name: Checkout
113+
uses: actions/checkout@v2
114+
with:
115+
fetch-depth: 0
116+
ref: ${{ github.head_ref }}
117+
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
118+
persist-credentials: false
119+
120+
- name: Prettify code
121+
uses: creyD/prettier_action@v4.2
122+
with:
123+
prettier_options: --write **/*.{js,md}
124+
only_changed: True
125+
# Set your custom token
126+
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
124127
```
125128
126129
#### Example 4 (dry run)
130+
127131
```yaml
128132
name: Continuous Integration
129133

@@ -136,19 +140,19 @@ jobs:
136140
runs-on: ubuntu-latest
137141

138142
steps:
139-
- name: Checkout
140-
uses: actions/checkout@v2
141-
with:
142-
fetch-depth: 0
143-
ref: ${{ github.head_ref }}
144-
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
145-
persist-credentials: false
146-
147-
- name: Prettify code
148-
uses: creyD/prettier_action@v4.1
149-
with:
150-
dry: True
151-
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
143+
- name: Checkout
144+
uses: actions/checkout@v2
145+
with:
146+
fetch-depth: 0
147+
ref: ${{ github.head_ref }}
148+
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
149+
persist-credentials: false
150+
151+
- name: Prettify code
152+
uses: creyD/prettier_action@v4.2
153+
with:
154+
dry: True
155+
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
152156
```
153157
154158
More documentation for writing a workflow can be found [here](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions).

entrypoint.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ if [ -n "$INPUT_PRETTIER_PLUGINS" ]; then
5959
for plugin in $INPUT_PRETTIER_PLUGINS; do
6060
echo "Checking plugin: $plugin"
6161
# check regex against @prettier/xyz
62-
if ! echo "$plugin" | grep -Eq '(@prettier\/)+(plugin-[a-z\-]+)'; then
62+
if ! echo "$plugin" | grep -Eq '(@prettier\/plugin-|(@[a-z\-]+\/)?prettier-plugin-){1}([a-z\-]+)'; then
6363
echo "$plugin does not seem to be a valid @prettier/plugin-x plugin. Exiting."
6464
exit 1
6565
fi
6666
done
67-
npm install --silent --global $INPUT_PRETTIER_PLUGINS
67+
npm install --silent $INPUT_PRETTIER_PLUGINS
6868
fi
6969
)
7070

0 commit comments

Comments
 (0)