From bb1ddce367328f6a56ebb4112be774e8d386dd30 Mon Sep 17 00:00:00 2001 From: nielm Date: Mon, 27 Nov 2023 16:53:15 +0100 Subject: [PATCH 1/3] Add dependabot and eslint actions --- .github/dependabot.yaml | 20 ++++++++++++ .github/workflows/eslint.yml | 37 ++++++++++++++++++++++ cloudrun-malware-scanner/.eslintrc.js | 2 +- cloudrun-malware-scanner/package-lock.json | 2 +- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yaml create mode 100644 .github/workflows/eslint.yml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..6fb5333 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,20 @@ +Worth setting up DependaBot for this? It's just one YAML file away :) + +.github/dependabot.yaml: + +--- +updates: + - directory: "/" + package-ecosystem: "github-actions" + schedule: + interval: "daily" + - directory: "/cloudrun-malware-scanner" + package-ecosystem: "npm" + schedule: + interval: "daily" + - directory: "/cloudrun-malware-scanner" + package-ecosystem: "docker" + schedule: + interval: "daily" +version: 2 +... diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..1729dde --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,37 @@ +name: "ESLint" + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + +jobs: + analyze: + name: "Eslint-analyze" + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODEJS_VERSION }} + check-latest: true + always-auth: true + + # Install eslint + - name: Install eslint + working-directory: cloudrun-malware-scanner/ + run: npm install eslint eslint-config-google + + - name: Run eslint + working-directory: cloudrun-malware-scanner/ + run: npm run eslint diff --git a/cloudrun-malware-scanner/.eslintrc.js b/cloudrun-malware-scanner/.eslintrc.js index 5ee7741..3e40b90 100644 --- a/cloudrun-malware-scanner/.eslintrc.js +++ b/cloudrun-malware-scanner/.eslintrc.js @@ -24,7 +24,7 @@ module.exports = { "SharedArrayBuffer": "readonly" }, "parserOptions": { - "ecmaVersion": 2018 + "ecmaVersion": 2020 }, "rules": { } diff --git a/cloudrun-malware-scanner/package-lock.json b/cloudrun-malware-scanner/package-lock.json index 7a6e723..efffd82 100644 --- a/cloudrun-malware-scanner/package-lock.json +++ b/cloudrun-malware-scanner/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "gcs-malware-scanner", - "version": "2.1.0", + "version": "2.3.0", "license": "Apache-2.0", "dependencies": { "@google-cloud/common": "^4.0.3", From e836675abfd4404c076caad74a5f7e00c870e32b Mon Sep 17 00:00:00 2001 From: nielm Date: Mon, 27 Nov 2023 20:08:42 +0100 Subject: [PATCH 2/3] Review comments --- .github/workflows/codeql.yml | 5 +---- .github/workflows/eslint.yml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3c90e26..2ef706b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,10 +13,7 @@ name: "CodeQL" on: push: - branches: [ "main" ] pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] schedule: - cron: '27 22 * * 5' @@ -38,7 +35,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 1729dde..b756ffe 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -1,11 +1,8 @@ -name: "ESLint" +name: "ESLint and NPM audit" on: push: - branches: [ "main" ] pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] jobs: analyze: @@ -18,20 +15,23 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: ${{ env.NODEJS_VERSION }} + node-version: 21 check-latest: true - always-auth: true # Install eslint - name: Install eslint working-directory: cloudrun-malware-scanner/ - run: npm install eslint eslint-config-google + run: npm install - - name: Run eslint + - name: NPM Audit + working-directory: cloudrun-malware-scanner/ + run: npm audit + + - name: ESlint working-directory: cloudrun-malware-scanner/ run: npm run eslint From a17be15837fc531770c90c1411975cb5dcb5978e Mon Sep 17 00:00:00 2001 From: nielm Date: Mon, 27 Nov 2023 20:31:47 +0100 Subject: [PATCH 3/3] Review typos fixing --- .github/dependabot.yaml | 4 ---- .github/workflows/eslint.yml | 1 - 2 files changed, 5 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 6fb5333..2f1434d 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,7 +1,3 @@ -Worth setting up DependaBot for this? It's just one YAML file away :) - -.github/dependabot.yaml: - --- updates: - directory: "/" diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index b756ffe..e213397 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -11,7 +11,6 @@ jobs: permissions: actions: read contents: read - security-events: write steps: - name: Checkout repository