chore(deps): dedupe pnpm-lock.yaml (#6164) #1257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Prettier | |
on: | |
push: | |
branches: [next] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
run: | |
name: Can the code be prettier? 🤔 | |
runs-on: ubuntu-latest | |
# workflow_dispatch always lets you select the branch ref, even though in this case we only ever want to run the action on `main` thus we need an if check | |
if: ${{ github.ref_name == 'next' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
v1-${{ runner.os }}-pnpm-store-${{ env.cache-name }}- | |
v1-${{ runner.os }}-pnpm-store- | |
v1-${{ runner.os }}- | |
- name: Install project dependencies | |
run: pnpm install --config.ignore-scripts=true | |
- name: Cache Prettier | |
uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/prettier/.prettier-cache | |
key: prettier-${{ hashFiles('pnpm-lock.yaml') }} | |
- run: pnpm chore:format:fix | |
- name: GitHub blocks PRs from automation that alter workflows in any way | |
run: git restore .github/workflows pnpm-lock.yaml | |
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.ECOSPARK_APP_ID }} | |
private_key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }} | |
- uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6 | |
with: | |
body: I ran `pnpm prettier` 🧑💻 | |
branch: actions/prettier-if-needed | |
commit-message: 'chore(prettier): fix unformatted files 🤖 ✨' | |
labels: 🤖 bot | |
title: 'chore(prettier): fix unformatted files 🤖 ✨' | |
token: ${{ steps.generate-token.outputs.token }} |