From 4fb87ade221504bb71fb20d8df7b2191977f308e Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 4 Nov 2020 10:44:09 -0500 Subject: [PATCH 1/3] chore: Pull JS Linting to separate Action Only trigger if JS, package, or Action file is changed --- .github/workflows/js-lint.yml | 59 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 41 ------------------------ 2 files changed, 59 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/js-lint.yml diff --git a/.github/workflows/js-lint.yml b/.github/workflows/js-lint.yml new file mode 100644 index 000000000000..2484bb8ca94e --- /dev/null +++ b/.github/workflows/js-lint.yml @@ -0,0 +1,59 @@ +name: Lint JS + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches-ignore: + - translations + +jobs: + see_if_should_skip: + runs-on: ubuntu-latest + + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289 + with: + cancel_others: 'false' + github_token: ${{ github.token }} + paths: '["**/*.js","package*.json",".github/workflows/js-lint.yml"]' + + lint: + runs-on: ubuntu-latest + needs: see_if_should_skip + if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} + steps: + - name: Check out repo + uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 + + - name: Setup node + uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d + with: + node-version: 14.x + + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + + - name: Cache node modules + uses: actions/cache@d1255ad9362389eac595a9ae406b8e8cb3331f16 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npx standard + + - name: Check dependencies + run: npm run check-deps diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e103a7bc7d3..158066be42b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,48 +28,7 @@ jobs: cancel_others: 'false' github_token: ${{ github.token }} paths: '[".github/workflows/test.yml",".node-version", ".npmrc", "app.json", "content/**", "data/**","lib/**", "Dockerfile", "feature-flags.json", "Gemfile", "Gemfile.lock", "middleware/**", "node_modules/**","package.json", "package-lock.json", "server.js", "tests/**", "translations/**", "Procfile", "webpack.config.js"]' - lint: - needs: see_if_should_skip - runs-on: ubuntu-latest - steps: - # Each of these ifs needs to be repeated at each step to make sure the required check still runs - # Even if if doesn't do anything - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Check out repo - uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 - - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Setup node - uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d - with: - node-version: 14.x - - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Get npm cache directory - id: npm-cache - run: | - echo "::set-output name=dir::$(npm config get cache)" - - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Cache node modules - uses: actions/cache@d1255ad9362389eac595a9ae406b8e8cb3331f16 - with: - path: ${{ steps.npm-cache.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Install dependencies - run: npm ci - - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Run linter - run: npx standard - - - if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }} - name: Check dependencies - run: npm run check-deps test: needs: see_if_should_skip runs-on: ubuntu-latest From 54830f6d919febc7c5ef0f0009d4a9132367ecee Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Wed, 4 Nov 2020 10:47:43 -0500 Subject: [PATCH 2/3] chore: Trim trailing whitespace --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7750d005e235..4ace2c750723 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ If you've found a problem, you can open an issue using a [template](https://gith #### Solve an issue -If you have a solution to one of the open issues, you will need to fork the repository and submit a PR using the [template](https://github.com/github/docs/blob/main/CONTRIBUTING.md#pull-request-template) that is visible automatically in the pull request body. For more details about this process, please check out [Getting Started with Contributing](/CONTRIBUTING.md). +If you have a solution to one of the open issues, you will need to fork the repository and submit a PR using the [template](https://github.com/github/docs/blob/main/CONTRIBUTING.md#pull-request-template) that is visible automatically in the pull request body. For more details about this process, please check out [Getting Started with Contributing](/CONTRIBUTING.md). #### Join us in discussions From 441c7f71cc40323eddd5fc6901e2095f1d8c06c5 Mon Sep 17 00:00:00 2001 From: "James M. Greene" Date: Wed, 4 Nov 2020 10:06:23 -0600 Subject: [PATCH 3/3] Update .github/workflows/js-lint.yml --- .github/workflows/js-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/js-lint.yml b/.github/workflows/js-lint.yml index 2484bb8ca94e..0c1c501b7731 100644 --- a/.github/workflows/js-lint.yml +++ b/.github/workflows/js-lint.yml @@ -21,7 +21,7 @@ jobs: with: cancel_others: 'false' github_token: ${{ github.token }} - paths: '["**/*.js","package*.json",".github/workflows/js-lint.yml"]' + paths: '["**/*.js", "package*.json", ".github/workflows/js-lint.yml"]' lint: runs-on: ubuntu-latest