-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (30 loc) · 1016 Bytes
/
format-source-code.yml
File metadata and controls
35 lines (30 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Unique name for this workflow
name: Validate Source Code
# Definition when the workflow should run
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
# Jobs to be executed
jobs:
validate-source-code-format:
runs-on: ubuntu-latest
steps:
# Checkout the code in the PR
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
# Install Node JS
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: "14"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit --prefer-offline
# Verify Source Format with Prettier
- name: Check format with Prettier
run: |
git diff -z --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha}}...${{ github.event.pull_request.head.sha }} | xargs -0 -I {} npx prettier --ignore-unknown --validate "{}"