add prettier job #61
Workflow file for this run
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: SDK CI | |
on: [ push, pull_request ] | |
jobs: | |
sdk-checks: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: sdk | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Run npm Install | |
run: npm install | |
- name: Unit Tests | |
run: npm run test | |
# Checks code formatting, fails if there are changes after applying prettier. | |
# Based on this example here: | |
# https://github.com/creyD/prettier_action?tab=readme-ov-file#example-4-dry-run | |
prettier: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: sdk | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Make sure the actual branch is checked out when running on pull requests | |
ref: ${{ github.head_ref }} | |
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config | |
persist-credentials: false | |
- name: Prettify code | |
uses: creyD/[email protected] | |
with: | |
# "dry" causes that if any file is modified, the job fails | |
dry: True | |
# "write" performs changes in place | |
prettier_options: --write | |
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} |