diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 8e4b2114f..23104d40b 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -3,9 +3,6 @@ name: autofix.ci # needed to securely identify the workflow on: pull_request: -permissions: - contents: read - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -14,5 +11,6 @@ jobs: fix: name: Run automated fix uses: prettier/shared-workflows/.github/workflows/automated-fix.yml@main + permissions: {} with: repository: prettier/prettier diff --git a/docs/ci.md b/docs/ci.md new file mode 100644 index 000000000..57834ed05 --- /dev/null +++ b/docs/ci.md @@ -0,0 +1,34 @@ +--- +id: ci +title: Run Prettier on CI +--- + +## GitHub Actions + +To apply autofix for Prettier from GitHub Actions, do the following: + +1. Install the [`autofix.ci`](https://github.com/apps/autofix-ci) GitHub App. +1. Make sure you have a **pinned** version of Prettier installed in your repository. +1. Create `.github/workflows/prettier.yml` with following content: + + ```yaml title=".github/workflows/prettier.yml" + name: autofix.ci + on: + pull_request: + push: + permissions: {} + jobs: + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - run: | + yarn + yarn prettier . --write + - uses: autofix-ci/action@v1 + with: + commit-message: "Apply Prettier format" + ``` + +For more information see [autofix.ci](https://autofix.ci/) website. diff --git a/website/sidebars.json b/website/sidebars.json index 2dbaa9ced..5604ffebc 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -15,7 +15,8 @@ "plugins", "cli", "api", - "browser" + "browser", + "ci" ], "Configuring Prettier": [ "options", diff --git a/website/versioned_docs/version-stable/ci.md b/website/versioned_docs/version-stable/ci.md new file mode 100644 index 000000000..57834ed05 --- /dev/null +++ b/website/versioned_docs/version-stable/ci.md @@ -0,0 +1,34 @@ +--- +id: ci +title: Run Prettier on CI +--- + +## GitHub Actions + +To apply autofix for Prettier from GitHub Actions, do the following: + +1. Install the [`autofix.ci`](https://github.com/apps/autofix-ci) GitHub App. +1. Make sure you have a **pinned** version of Prettier installed in your repository. +1. Create `.github/workflows/prettier.yml` with following content: + + ```yaml title=".github/workflows/prettier.yml" + name: autofix.ci + on: + pull_request: + push: + permissions: {} + jobs: + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - run: | + yarn + yarn prettier . --write + - uses: autofix-ci/action@v1 + with: + commit-message: "Apply Prettier format" + ``` + +For more information see [autofix.ci](https://autofix.ci/) website. diff --git a/website/versioned_sidebars/version-stable-sidebars.json b/website/versioned_sidebars/version-stable-sidebars.json index 2dbaa9ced..5604ffebc 100644 --- a/website/versioned_sidebars/version-stable-sidebars.json +++ b/website/versioned_sidebars/version-stable-sidebars.json @@ -15,7 +15,8 @@ "plugins", "cli", "api", - "browser" + "browser", + "ci" ], "Configuring Prettier": [ "options",