name: 'Prettier' on: workflow_dispatch: inputs: branch: required: true description: 'Name of the branch to run prettier' run-name: 'Prettify "${{ github.event.inputs.branch }}" (by ${{ github.actor }})' jobs: prettier: runs-on: ubuntu-22.04 steps: - name: checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 2 ref: ${{ github.event.inputs.branch }} token: ${{ secrets.GITHUB_TOKEN }} - name: setup environment uses: ./.github/actions/setup with: actor: prettier - name: Cache ESLint and Prettier uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4 with: path: | .eslintcache node_modules/.cache/prettier key: lint-cache-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | lint-cache-${{ hashFiles('**/pnpm-lock.yaml') }}- - name: prettier run: pnpm prettier - name: push changes shell: sh run: | changed=`git diff-index HEAD` if [ -n "$changed" ] then git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git commit -am "Prettier" git push fi