From 8a16fc9688bd19b14ae68df32693887a3be03649 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Sat, 8 Jan 2022 12:37:59 -0600 Subject: [PATCH 1/4] Don't install plugins globally This fixes a problem where @prettier/plugin-ruby was not being used. --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index b31f096..0341d92 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -64,7 +64,7 @@ if [ -n "$INPUT_PRETTIER_PLUGINS" ]; then exit 1 fi done - npm install --silent --global $INPUT_PRETTIER_PLUGINS + npm install --silent $INPUT_PRETTIER_PLUGINS fi ) From 9dff813935c90d4015c2a80f7d87a65751b1939c Mon Sep 17 00:00:00 2001 From: Bernie Cosgriff <56446898+bercos@users.noreply.github.com> Date: Fri, 14 Jan 2022 16:27:39 -0700 Subject: [PATCH 2/4] Fix #78 Fix https://github.com/creyD/prettier_action/issues/78 by updating the regex. I tested the regex but was not sure how to test the action. The regex should cover all three valid cases outlined here https://prettier.io/docs/en/plugins.html. --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index b31f096..d3242fe 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -59,7 +59,7 @@ if [ -n "$INPUT_PRETTIER_PLUGINS" ]; then for plugin in $INPUT_PRETTIER_PLUGINS; do echo "Checking plugin: $plugin" # check regex against @prettier/xyz - if ! echo "$plugin" | grep -Eq '(@prettier\/)+(plugin-[a-z\-]+)'; then + if ! echo "$plugin" | grep -Eq '(@prettier\/plugin-|(@[a-z\-]+\/)?prettier-plugin-){1}([a-z\-]+)'; then echo "$plugin does not seem to be a valid @prettier/plugin-x plugin. Exiting." exit 1 fi From ac20e98371ea813a6b67b3487fbd7a5f06d52ed5 Mon Sep 17 00:00:00 2001 From: Conrad Date: Sat, 15 Jan 2022 22:13:48 +0100 Subject: [PATCH 3/4] Using latest version in the examples --- README.md | 114 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 59 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 6064b42..ad1e33c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ [![Contributors](https://img.shields.io/github/contributors-anon/creyD/prettier_action)](https://github.com/creyD/prettier_action/graphs/contributors) [![Issues](https://img.shields.io/github/issues/creyD/prettier_action)](https://github.com/creyD/prettier_action/issues) - A GitHub action for styling files with [prettier](https://prettier.io). ## Usage @@ -35,7 +34,9 @@ A GitHub action for styling files with [prettier](https://prettier.io). ### Example Config > Hint: if you still use the old naming convention or generally a different branch name, please replace the `main` in the following configurations. + #### Example 1 (run on push in branch main) + ```yaml name: Continuous Integration @@ -44,27 +45,28 @@ on: pull_request: push: branches: - - main + - main jobs: prettier: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - - - name: Prettify code - uses: creyD/prettier_action@v4.1.1 - with: - # This part is also where you can pass other options, for example: - prettier_options: --write **/*.{js,md} + - name: Checkout + uses: actions/checkout@v2 + with: + # Make sure the actual branch is checked out when running on pull requests + ref: ${{ github.head_ref }} + + - name: Prettify code + uses: creyD/prettier_action@v4.2 + with: + # This part is also where you can pass other options, for example: + prettier_options: --write **/*.{js,md} ``` #### Example 2 (using the only_changed or same_commit option on PR) + ```yaml name: Continuous Integration @@ -77,23 +79,24 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - # This is important to fetch the changes to the previous commit - fetch-depth: 0 - - - name: Prettify code - uses: creyD/prettier_action@v4.1.1 - with: - # This part is also where you can pass other options, for example: - prettier_options: --write **/*.{js,md} - only_changed: True + - name: Checkout + uses: actions/checkout@v2 + with: + # Make sure the actual branch is checked out when running on pull requests + ref: ${{ github.head_ref }} + # This is important to fetch the changes to the previous commit + fetch-depth: 0 + + - name: Prettify code + uses: creyD/prettier_action@v4.2 + with: + # This part is also where you can pass other options, for example: + prettier_options: --write **/*.{js,md} + only_changed: True ``` #### Example 3 (using a custom access token on PR) + ```yaml name: Continuous Integration @@ -106,24 +109,25 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} - # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config - persist-credentials: false - - - name: Prettify code - uses: creyD/prettier_action@v4.1 - with: - prettier_options: --write **/*.{js,md} - only_changed: True - # Set your custom token - github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config + persist-credentials: false + + - name: Prettify code + uses: creyD/prettier_action@v4.2 + with: + prettier_options: --write **/*.{js,md} + only_changed: True + # Set your custom token + github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} ``` #### Example 4 (dry run) + ```yaml name: Continuous Integration @@ -136,19 +140,19 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.head_ref }} - # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config - persist-credentials: false - - - name: Prettify code - uses: creyD/prettier_action@v4.1 - with: - dry: True - github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config + persist-credentials: false + + - name: Prettify code + uses: creyD/prettier_action@v4.2 + with: + dry: True + github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} ``` 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). From 0bf5ce065a5798dcf328a8091e4f34c4d50d1795 Mon Sep 17 00:00:00 2001 From: Conrad Date: Sat, 15 Jan 2022 22:15:20 +0100 Subject: [PATCH 4/4] Updated bug and feature templates --- .github/ISSUE_TEMPLATE/bug_report.md | 8 ++++---- .github/ISSUE_TEMPLATE/feature_request.md | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 881236f..2d0459c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,12 +3,12 @@ name: Bug report about: Report a problem! title: "[BUG]" labels: bug -assignees: '' - +assignees: "" --- **What exactly happened?** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -21,8 +21,8 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Where did you encounter the problem?** - - OS: [e.g. iOS] + - Repo: [e.g. URL to your repository] - - Version [e.g. 22] +- Version [e.g. 22] diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f302208..2ee4b73 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,12 +3,11 @@ name: Feature request about: Request a feature! title: "[FEATURE]" labels: enhancement -assignees: '' - +assignees: "" --- **What would you like to change about the program?** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +A clear and concise description of what the problem is. **Why do you think this is a cool idea?** A clear and concise description of why your feature would improve the program.