Applied prettier formatting #325
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: Format Code Using Prettier | |
on: | |
push: | |
branches: | |
- truth-redefined-again | |
- main | |
jobs: | |
main: | |
if: ${{ github.event.pusher.name != 'koss-service' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.KS_PAT }} | |
- name: Install and Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Install pnpm dependencies | |
run: pnpm install | |
- name: Format code | |
run: pnpm format | |
- name: Configure SSH key | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.KS_SSH_PRIVATE_KEY }} | |
SSH_PUBLIC_KEY: ${{ secrets.KS_SSH_PUBLIC_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/koss-service | |
echo "$SSH_PUBLIC_KEY" > ~/.ssh/koss-service.pub | |
chmod 600 ~/.ssh/koss-service | |
chmod 600 ~/.ssh/koss-service.pub | |
- name: Configure git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "koss-service" | |
git config --global gpg.format ssh | |
git config --global user.signingkey ~/.ssh/koss-service.pub | |
- name: Push | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git commit -S -am "Applied prettier formatting" | |
git push | |
else | |
echo "No changes in $file." | |
fi |