From 99ae12aaa29114c4184aadaf48c90d3a515265bc Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 7 Jan 2022 13:24:15 +0100 Subject: [PATCH 1/5] check github actions yamls --- .github/workflows/check-config.yml | 4 +--- .github/workflows/check-yaml.yml | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/check-yaml.yml diff --git a/.github/workflows/check-config.yml b/.github/workflows/check-config.yml index 5b3af314..1ee8aab6 100644 --- a/.github/workflows/check-config.yml +++ b/.github/workflows/check-config.yml @@ -1,4 +1,4 @@ -on: +on: pull_request: paths: - 'configs/*.json' @@ -8,8 +8,6 @@ name: Check Config jobs: check-config: runs-on: ubuntu-latest - outputs: - targets: ${{ steps.set-matrix.outputs.targets }} steps: - uses: actions/checkout@v2 - name: check if config files are sorted alphabetically diff --git a/.github/workflows/check-yaml.yml b/.github/workflows/check-yaml.yml new file mode 100644 index 00000000..99ccd4c7 --- /dev/null +++ b/.github/workflows/check-yaml.yml @@ -0,0 +1,22 @@ +on: + pull_request: + paths: + - '.github/actions/*/*.yml' + - '.github/workflows/*.yml' + - 'templates/.github/actions/*/*.yml' + - 'templates/.github/workflows/*.yml' + +name: Check YAML + +jobs: + check-yaml: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: galargh/validate-yaml-schema@0be36a8865108d9fc0b2cae260dc0f9f649fac96 # forked v1.0.3 + with: + yamlSchemasJson: | + { + "https://json.schemastore.org/github-action.json": [".github/actions/*/*.yml", "templates/.github/actions/*/*.yml"], + "https://json.schemastore.org/github-workflow.json": [".github/workflows/*.yml", "templates/.github/workflows/*.yml"] + } From 5b53e322b421cc0aa96f583d8deef0530da293ab Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 7 Jan 2022 17:48:49 +0100 Subject: [PATCH 2/5] make yaml linter happy about go-test --- templates/.github/workflows/go-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/.github/workflows/go-test.yml b/templates/.github/workflows/go-test.yml index 01294752..e5b67a53 100644 --- a/templates/.github/workflows/go-test.yml +++ b/templates/.github/workflows/go-test.yml @@ -10,8 +10,8 @@ jobs: go: [ "1.16.x", "1.17.x" ] env: COVERAGES: "" - runs-on: ${{ matrix.os }}-latest - name: ${{ matrix.os}} (go ${{ matrix.go }}) + runs-on: ${{ format('${0}-latest', matrix.os) }} + name: ${{ matrix.os }} (go ${{ matrix.go }}) steps: - uses: actions/checkout@v2 with: From 810e6fb5952ef53dcc9c8751b15513fad0ac10e3 Mon Sep 17 00:00:00 2001 From: galargh Date: Fri, 7 Jan 2022 18:18:18 +0100 Subject: [PATCH 3/5] mention VS Code YAML extension in the readme --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9159f46c..c951551a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Some repositories may require some pre-setup steps to be run before tests (or co runs: using: "composite" steps: - - name: Step 1 + - name: Step 1 shell: bash run: echo "do some initial setup" - name: Step 2 @@ -60,5 +60,11 @@ If you want your project to participle, please send a PR! ## Development +### Branches + The `master` branch contains currently deployed workflows. When we make minor changes to these workflows, we don't always want these changes to get deployed to all hundreds of repositories, as this creates a lot of unnecessary noise. Minor changes to the workflows are therefore merged into the [`next`](https://github.com/protocol/.github/tree/next) branch. When the time has come, we create a PR from the `next` branch to `master` to trigger a deployment to all repositores. + +### IDE + +If you're using [Visual Studio Code](https://code.visualstudio.com/) for development, you might want to install the [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension. It is configured to perform GitHub workflow/action linting out-of-the-box. From f805e7c6de32a1bd2555f37b9a2f1f877739a145 Mon Sep 17 00:00:00 2001 From: Piotr Galar Date: Mon, 10 Jan 2022 12:09:16 +0100 Subject: [PATCH 4/5] add info about other YAML checking extensions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c951551a..3b66715c 100644 --- a/README.md +++ b/README.md @@ -67,4 +67,4 @@ When we make minor changes to these workflows, we don't always want these change ### IDE -If you're using [Visual Studio Code](https://code.visualstudio.com/) for development, you might want to install the [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension. It is configured to perform GitHub workflow/action linting out-of-the-box. +If you're using [Visual Studio Code](https://code.visualstudio.com/) for development, you might want to install the [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension. It is configured to perform GitHub workflow/action linting out-of-the-box. If you're using a different IDE, you can check if a [client](https://github.com/redhat-developer/yaml-language-server#clients) for it exists. From 363626658b01fee6822ccf9438736973ece0b826 Mon Sep 17 00:00:00 2001 From: galargh Date: Tue, 11 Jan 2022 09:35:01 +0100 Subject: [PATCH 5/5] make yaml checker more generic --- .github/workflows/check-yaml.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-yaml.yml b/.github/workflows/check-yaml.yml index 99ccd4c7..b02dc279 100644 --- a/.github/workflows/check-yaml.yml +++ b/.github/workflows/check-yaml.yml @@ -1,10 +1,10 @@ on: pull_request: paths: - - '.github/actions/*/*.yml' - - '.github/workflows/*.yml' - - 'templates/.github/actions/*/*.yml' - - 'templates/.github/workflows/*.yml' + - '**/action.yml' + - '**/action.yaml' + - '**/.github/workflows/*.yml' + - '**/.github/workflows/*.yaml' name: Check YAML @@ -13,10 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: galargh/validate-yaml-schema@0be36a8865108d9fc0b2cae260dc0f9f649fac96 # forked v1.0.3 + # TODO: switch to mainline once https://github.com/nwisbeta/validate-yaml-schema/pull/21 is merged + - uses: galargh/validate-yaml-schema@c8060d4a389d0eec986a90665bf0c496bf1f52e8 with: yamlSchemasJson: | { - "https://json.schemastore.org/github-action.json": [".github/actions/*/*.yml", "templates/.github/actions/*/*.yml"], - "https://json.schemastore.org/github-workflow.json": [".github/workflows/*.yml", "templates/.github/workflows/*.yml"] + "https://json.schemastore.org/github-action.json": ["**/action.yml", "**/action.yaml"], + "https://json.schemastore.org/github-workflow.json": ["**/.github/workflows/*.yml", "**/.github/workflows/*.yaml"] }