Skip to content

Add frontend serverSecurity service #1492

Add frontend serverSecurity service

Add frontend serverSecurity service #1492

Workflow file for this run

name: Prettier
on:
pull_request:
jobs:
prettier:
name: Ensure the code format on the changed files
runs-on: ubuntu-latest
steps:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
- name: Checkout code
uses: actions/checkout@v4
# - https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Verify the changed files
run: |
REMOTE_NAME=origin
echo "Base ref: $GITHUB_BASE_REF"
echo "Head ref: $GITHUB_HEAD_REF"
echo "Fetching branch: $GITHUB_BASE_REF"
git fetch origin $GITHUB_BASE_REF
echo "Fetching branch: $GITHUB_HEAD_REF"
git fetch origin $GITHUB_HEAD_REF
echo "Listing branches"
git branch -a
echo "Getting diff files ignoring deleted and getting the changed or renamed files"
CHANGED_FILES=$(git diff --name-status --diff-filter d ${REMOTE_NAME}/${GITHUB_BASE_REF}..${REMOTE_NAME}/${GITHUB_HEAD_REF} | awk '{print $NF}')
echo "Changed files:"
echo "${CHANGED_FILES}"
git checkout $GITHUB_HEAD_REF
echo "Installing dependencies"
yarn
echo "Running prettier on the changed files"
npx prettier ${CHANGED_FILES} --check --ignore-unknown