From a6dc56d5ca50a6639f23f359f6ac105a77633f41 Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 28 May 2024 19:23:27 +0200 Subject: [PATCH] Fix potential github action smells (#3826) - Avoid running CI related actions when no source code has changed - Steps should only perform a single command - Avoid deploying jobs on forks --- .github/workflows/site.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 0e1f90eda2..f8c7eb716f 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -6,6 +6,8 @@ on: # Runs on pushes targeting the main branch push: branches: [main] + paths: + - webiste/** # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -45,14 +47,17 @@ jobs: - name: Build run: npm run build - name: Install website dependencies - run: cd website && npm ci + working-directory: website + run: npm ci - name: Sync Crowdin - run: cd website && npm run crowdin:sync + working-directory: website + run: npm run crowdin:sync continue-on-error: true env: CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - name: Build docs - run: cd website && npm run build + working-directory: website + run: npm run build - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: @@ -65,6 +70,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build + if: ${{github.repository == 'cheeriojs/cheerio'}} steps: - name: Deploy to GitHub Pages id: deployment