From 74964ada6ab5468f16d19d20fe01b8858f8f8b63 Mon Sep 17 00:00:00 2001 From: Splines Date: Wed, 6 Dec 2023 18:29:37 +0100 Subject: [PATCH] Clean up GitHub Actions files --- .github/actions/changed_files/action.yml | 4 +--- .github/workflows/linter.yml | 27 ++++++++++-------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.github/actions/changed_files/action.yml b/.github/actions/changed_files/action.yml index 3143a4c30..0af0b6e91 100644 --- a/.github/actions/changed_files/action.yml +++ b/.github/actions/changed_files/action.yml @@ -15,13 +15,11 @@ outputs: value: ${{ steps.get-changed-files.outputs.files }} runs: - # For a small tutorial on GitHub composite actions, see - # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action using: "composite" steps: # This has to be done in the main workflow, not in the action, because # otherwise this reusable action is not available in the workflow. - # - name: "Checkout PR branch (with test merge-commit)" + # - name: "Checkout code (on a PR branch)" # uses: actions/checkout@v4 # with: # fetch-depth: 2 # to also fetch parent of PR diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index bdb6422a2..6fb01c536 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -8,19 +8,14 @@ on: jobs: - # Resources: - # number [1] being most important - # [1] https://github.com/actions/checkout/issues/520#issuecomment-1167205721 - # [2] https://robertfaldo.medium.com/commands-to-run-rubocop-and-specs-you-changed-in-your-branch-e6d2f2e4110b - # [3] https://community.atlassian.com/t5/Bitbucket-questions/Git-diff-show-different-files-than-PR-Pull-Request/qaq-p/2331786 rubocop: name: RuboCop (Ruby) runs-on: ubuntu-latest steps: - - name: Checkout PR branch (with test merge-commit) + - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 2 # to also fetch parent of PR + fetch-depth: 2 # to also fetch parent of PR (used to get changed files) - name: Get changed files id: rb-changed @@ -45,29 +40,29 @@ jobs: name: ESLint (JS) runs-on: ubuntu-latest steps: - - name: Checkout custom reusable actions - uses: actions/checkout@v4 # used to checkout custom reusable actions + - name: Checkout code + uses: actions/checkout@v4 with: - fetch-depth: 2 # to also fetch parent of PR + fetch-depth: 2 # to also fetch parent of PR (used to get changed files) - name: Get changed files - id: eslint-changed + id: js-changed uses: ./.github/actions/changed_files/ with: file-extensions: \.js$|\.js.erb$ - name: Setup Node.js - if: ${{ steps.eslint-changed.outputs.changed-files != ''}} + if: ${{ steps.js-changed.outputs.changed-files != ''}} uses: actions/setup-node@v4 with: node-version: '20' # End of Life (EOL): April 2026 - + - name: Install dependencies - if: ${{ steps.eslint-changed.outputs.changed-files != ''}} + if: ${{ steps.js-changed.outputs.changed-files != ''}} run: yarn install - name: Run ESLint - if: ${{ steps.eslint-changed.outputs.changed-files != ''}} + if: ${{ steps.js-changed.outputs.changed-files != ''}} run: | echo "🚨 Running ESLint version: $(yarn run eslint --version)" - yarn run eslint --ignore-path .gitignore --max-warnings 0 ${{ steps.eslint-changed.outputs.changed-files }} + yarn run eslint --ignore-path .gitignore --max-warnings 0 ${{ steps.js-changed.outputs.changed-files }}