From ec527fa85142726a6c8095703f8d094433cd8802 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Wed, 22 Nov 2023 16:34:37 +0100 Subject: [PATCH 1/3] Set up CI to lint workflows with action-validator --- .github/workflows/main.yml | 18 +++++++++++++++++- package.json | 8 ++++++-- yarn.lock | 17 +++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ab9377b..eaa1645 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,23 @@ jobs: node-version: ${{ matrix.node }} cache: "yarn" - run: yarn install - - run: yarn lint + - run: yarn lint:js + + workflow_lint: + name: "Workflow Lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + cache: "yarn" + + - name: Install Deps + run: "yarn install --frozen-lockfile" + + - name: Run Linter + run: "yarn lint:workflows" build: name: "Build (Node ${{ matrix.node }})" diff --git a/package.json b/package.json index 69758a5..09ecafd 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,15 @@ "build:compile": "babel -d lib --verbose --extensions \".ts,.tsx\" src", "start": "tsc -p ./tsconfig.build.json -w", "test": "jest", - "lint": "eslint src test && tsc --noEmit && prettier --check .", - "lint:fix": "prettier --write . && eslint --fix src test", + "lint": "yarn lint:js && yarn lint:workflows", + "lint:js": "eslint src test && tsc --noEmit && prettier --check .", + "lint:js-fix": "prettier --write . && eslint --fix src test", + "lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'", "prepublishOnly": "yarn build" }, "devDependencies": { + "@action-validator/cli": "^0.5.3", + "@action-validator/core": "^0.5.3", "@babel/cli": "^7.17.6", "@babel/core": "^7.17.8", "@babel/eslint-parser": "^7.17.0", diff --git a/yarn.lock b/yarn.lock index 9ebc4a4..7d86175 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,18 @@ # yarn lockfile v1 +"@action-validator/cli@^0.5.3": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@action-validator/cli/-/cli-0.5.3.tgz#2d4fe473058f6ef17530b9bb5929f0eade4e8672" + integrity sha512-u/kv77ZC55PfAc9RQeP76xV1GysTisEJjO+b5TgCrBBcaKtGLt5Y7ki2GSdc7CDzncNc1oeoGcwaLMW6JSdQAw== + dependencies: + chalk "5.2.0" + +"@action-validator/core@^0.5.3": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@action-validator/core/-/core-0.5.3.tgz#493b850ef7a2801830069d78f60cbefe0697423f" + integrity sha512-0ABelaY7nmpvV5q0z8Vl1cDeq2OZ1HyNXjXS54fBadLaCssZLbDvTa7M2uUaNMcEWV+Xl48WWbnqJWKePt9qHQ== + "@adobe/css-tools@^4.0.1": version "4.3.1" resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.1.tgz#abfccb8ca78075a2b6187345c26243c1a0842f28" @@ -2145,6 +2157,11 @@ caniuse-lite@^1.0.30001317: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001325.tgz#2b4ad19b77aa36f61f2eaf72e636d7481d55e606" integrity sha512-sB1bZHjseSjDtijV1Hb7PB2Zd58Kyx+n/9EotvZ4Qcz2K3d0lWB8dB4nb8wN/TsOGFq3UuAm0zQZNQ4SoR7TrQ== +chalk@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" + integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== + chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" From 4f5a31576a7afcf40f2cae7b0acc14f68febc667 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Wed, 22 Nov 2023 17:07:45 +0100 Subject: [PATCH 2/3] Use * (latest cached) rather than latest version --- .github/workflows/main.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eaa1645..15da377 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,14 +9,14 @@ jobs: # ================================================ eslint: - name: "ESLint (Node ${{ matrix.node }})" + name: "ESLint (Node ${{ matrix.node == '*' && 'latest' || matrix.node }})" runs-on: ubuntu-latest strategy: matrix: - node: [18, latest] + node: [18, *] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: "yarn" @@ -40,14 +40,14 @@ jobs: run: "yarn lint:workflows" build: - name: "Build (Node ${{ matrix.node }})" + name: "Build (Node ${{ matrix.node == '*' && 'latest' || matrix.node }})" runs-on: ubuntu-latest strategy: matrix: - node: [18, latest] + node: [18, *] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: "yarn" @@ -55,14 +55,14 @@ jobs: - run: yarn build tests: - name: "Tests (Node ${{ matrix.node }})" + name: "Tests (Node ${{ matrix.node == '*' && 'latest' || matrix.node }})" runs-on: ubuntu-latest strategy: matrix: - node: [18, latest] + node: [18, *] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: "yarn" From 70bf74252f38c2d1802383144b29b6028c46e44d Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Wed, 22 Nov 2023 17:15:58 +0100 Subject: [PATCH 3/3] Add missing quotes --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15da377..59ca7e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [18, *] + node: [18, "*"] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -44,7 +44,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [18, *] + node: [18, "*"] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [18, *] + node: [18, "*"] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4