From 993cfcd19247e86e7c122c41bdefe7cbb018929a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:08:04 -0500 Subject: [PATCH] ci(workflows): enable prettier for forks --- .github/workflows/update-prettier.yml | 33 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-prettier.yml b/.github/workflows/update-prettier.yml index e5c37af84..f12fee885 100644 --- a/.github/workflows/update-prettier.yml +++ b/.github/workflows/update-prettier.yml @@ -4,17 +4,18 @@ name: Update Prettier branches: - renovate/prettier-* -permissions: - contents: read - jobs: update_prettier: + if: github.repository_owner == 'octokit' runs-on: ubuntu-latest + permissions: + contents: read + steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 cache: npm - run: npm ci - run: npm run lint:fix @@ -26,3 +27,27 @@ jobs: body: An update to prettier required updates to your code. branch: ${{ github.ref }} commit-message: "style: prettier" + + update_prettier_fork: + if: github.repository_owner != 'octokit' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run lint:fix + - uses: gr2m/create-or-update-pull-request-action@v1.x + env: + GITHUB_TOKEN: ${{ github.token }} + with: + title: Prettier updated + body: An update to prettier required updates to your code. + branch: ${{ github.ref }} + commit-message: "style: prettier"