From 0c7342cb20c51d049997597b5b96de1744bd7b66 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Fri, 24 Nov 2023 15:41:19 +0100 Subject: [PATCH] Set up CI to lint workflows with action-validator (#3905) * Set up CI to lint workflows with action-validator * Rename release-action workflow --- .../{release-action.yml => release-make.yml} | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/static_analysis.yml | 16 ++++++++++++++++ package.json | 5 ++++- yarn.lock | 17 +++++++++++++++++ 5 files changed, 39 insertions(+), 3 deletions(-) rename .github/workflows/{release-action.yml => release-make.yml} (99%) diff --git a/.github/workflows/release-action.yml b/.github/workflows/release-make.yml similarity index 99% rename from .github/workflows/release-action.yml rename to .github/workflows/release-make.yml index 59b6ac20d9f..ef2bd09b1ee 100644 --- a/.github/workflows/release-action.yml +++ b/.github/workflows/release-make.yml @@ -1,4 +1,4 @@ -name: Release Action +name: Release Make on: workflow_call: secrets: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc523b78111..fccff0d61dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ on: concurrency: ${{ github.workflow }} jobs: release: - uses: matrix-org/matrix-js-sdk/.github/workflows/release-action.yml@develop + uses: matrix-org/matrix-js-sdk/.github/workflows/release-make.yml@develop secrets: inherit with: final: ${{ inputs.mode == 'final' }} diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 9e35aac0957..579be86ad42 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -51,6 +51,22 @@ jobs: - name: Run Linter run: "yarn run 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" + docs: name: "JSDoc Checker" runs-on: ubuntu-latest diff --git a/package.json b/package.json index d9f2d182aad..e173b8588b9 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,11 @@ "build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly", "build:compile": "babel -d lib --verbose --extensions \".ts,.js\" src", "gendoc": "typedoc", - "lint": "yarn lint:types && yarn lint:js", + "lint": "yarn lint:types && yarn lint:js && yarn lint:workflows", "lint:js": "eslint --max-warnings 0 src spec && prettier --check .", "lint:js-fix": "prettier --loglevel=warn --write . && eslint --fix src spec", "lint:types": "tsc --noEmit", + "lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'", "test": "jest", "test:watch": "jest --watch", "coverage": "yarn test --coverage" @@ -66,6 +67,8 @@ "uuid": "9" }, "devDependencies": { + "@action-validator/cli": "^0.5.3", + "@action-validator/core": "^0.5.3", "@babel/cli": "^7.12.10", "@babel/core": "^7.12.10", "@babel/eslint-parser": "^7.12.10", diff --git a/yarn.lock b/yarn.lock index 5475d4d5d8d..442e4127115 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,6 +7,18 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== +"@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== + "@actions/core@^1.4.0": version "1.10.0" resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" @@ -2542,6 +2554,11 @@ caniuse-lite@^1.0.30001541: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001562.tgz#9d16c5fd7e9c592c4cd5e304bc0f75b0008b2759" integrity sha512-kfte3Hym//51EdX4239i+Rmp20EsLIYGdPkERegTgU19hQWCRhsRFGKHTliUlsry53tv17K7n077Kqa0WJU4ng== +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@5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"