From e3a5b70726a37c3f446c18e3245539cdeccdbab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Fri, 11 Feb 2022 11:44:04 +0100 Subject: [PATCH 1/3] add github action for yamllint --- .github/workflows/yaml-lint.yml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/yaml-lint.yml diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml new file mode 100644 index 0000000000..90d19f8259 --- /dev/null +++ b/.github/workflows/yaml-lint.yml @@ -0,0 +1,37 @@ +name: Lint YAML +on: [push, pull_request] +jobs: + YAML: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v2 + - name: Install yaml-lint + run: npm install -g yaml-lint + - name: Run yaml-lint + run: yamllint $(find ${GITHUB_WORKSPACE} -type f -name "*.yml" -o -name "*.yaml") -c ${GITHUB_WORKSPACE}/.yamllint.yml + + # If the above check failed, post a comment on the PR explaining the failure + - name: Post PR comment + if: failure() + uses: mshick/add-pr-comment@v1 + with: + message: | + ## YAML linting is failing + + To keep the code consistent with lots of contributors, we run automated code consistency checks. + To fix this CI test, please run: + + * Install `yaml-lint` + * [Install `npm`](https://www.npmjs.com/get-npm) then [install `yaml-lint`](https://www.npmjs.com/package/yaml-lint) (`npm install -g yaml-lint`) + * Fix the markdown errors + * Run the test locally: `yamllint $(find . -type f -name "*.yml" -o -name "*.yaml") -c ./.yamllint.yml` + * Fix any reported errors in your YAML files + + Once you push these changes the test should pass, and you can hide this comment :+1: + + We highly recommend setting up yaml-lint in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help! + + Thanks again for your contribution! + repo-token: ${{ secrets.GITHUB_TOKEN }} + allow-repeats: false \ No newline at end of file From fad98f483d868d16bf6ce09d27367480696eac97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Fri, 11 Feb 2022 11:48:19 +0100 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f494157b6..36bf00eb4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Add retry strategy for AWS megatests after releasing [nf-core/tower-action v2.2](https://github.com/nf-core/tower-action/releases/tag/v2.2) * Update igenomes path to the `BWAIndex` to fetch the whole `version0.6.0` folder instead of only the `genome.fa` file * Remove pinned Node version in the GitHub Actions workflows, to fix errors with `markdownlint` +* Add yamllint GitHub Action. * Add `.yamllint.yml` to avoid line length and document start errors ([#1407](https://github.com/nf-core/tools/issues/1407)) ## General From fde544f0821bebdc55d57325e56cc485bbc672ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Fri, 11 Feb 2022 11:55:00 +0100 Subject: [PATCH 3/3] fix errors by newly introduced yaml-linting --- .github/workflows/push_dockerhub_dev.yml | 1 - .github/workflows/tools-api-docs-release.yml | 6 +++--- .github/workflows/yaml-lint.yml | 2 +- .yamllint.yml | 3 ++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push_dockerhub_dev.yml b/.github/workflows/push_dockerhub_dev.yml index e0c26f2f4e..3a0e789d5b 100644 --- a/.github/workflows/push_dockerhub_dev.yml +++ b/.github/workflows/push_dockerhub_dev.yml @@ -27,4 +27,3 @@ jobs: run: | echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin docker push nfcore/tools:dev - diff --git a/.github/workflows/tools-api-docs-release.yml b/.github/workflows/tools-api-docs-release.yml index 8c47f2dd0e..c420824722 100644 --- a/.github/workflows/tools-api-docs-release.yml +++ b/.github/workflows/tools-api-docs-release.yml @@ -9,9 +9,9 @@ jobs: runs-on: ubuntu-18.04 strategy: matrix: - dir: - - latest - - ${{ github.event.release.tag_name }} + dir: + - latest + - ${{ github.event.release.tag_name }} steps: - name: Check out source-code repository uses: actions/checkout@v2 diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml index 90d19f8259..13a7aa23b4 100644 --- a/.github/workflows/yaml-lint.yml +++ b/.github/workflows/yaml-lint.yml @@ -34,4 +34,4 @@ jobs: Thanks again for your contribution! repo-token: ${{ secrets.GITHUB_TOKEN }} - allow-repeats: false \ No newline at end of file + allow-repeats: false diff --git a/.yamllint.yml b/.yamllint.yml index 6889fa342e..e214bcc350 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,5 +1,6 @@ extends: default - +ignore: | + nf_core/*-template/ rules: document-start: disable line-length: disable