remove blog post :sweat-smile: #133
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: Lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
run-linters: | |
name: Run linters | |
runs-on: ubuntu-latest | |
# Used to loop through each project and lint it | |
strategy: | |
matrix: | |
project: ["about", "writing", "photos", "music", "uploader"] | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Only lint if there are changes in project | |
run: | | |
git reset --soft HEAD~1 | |
if [[ `git status --porcelain ${{ matrix.project }}/` ]]; then | |
echo "Project changes found, linting project" | |
echo "SHOULD_LINT=true" >> $GITHUB_ENV | |
else | |
echo "No changes for project found in last commit" | |
echo "SHOULD_LINT=false" >> $GITHUB_ENV | |
fi | |
git reset ORIG_HEAD | |
- name: Set up Node.js | |
if: ${{ env.SHOULD_LINT == 'true' }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Install top-level Node.js dependencies | |
if: ${{ env.SHOULD_LINT == 'true' }} | |
run: npm i | |
- name: Install Node.js dependencies | |
if: ${{ env.SHOULD_LINT == 'true' }} | |
run: cd ./${{ matrix.project }} && npm i | |
- name: Run linters | |
if: ${{ env.SHOULD_LINT == 'true' }} | |
run: cd ./${{ matrix.project }} && npm run lint | |