From 74736c08a3c44b2b94607d929b669c54efa02c8c Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 13 May 2024 20:18:07 +0200 Subject: [PATCH] Add linting workflow with yamllint; fix linting issues (#396) * Add linting workflow with yamllint. Fix linting issues. * Use nox for running yamllint. --- .github/dependabot.yml | 2 +- .github/workflows/ansible-release.yml | 45 +++++++++++++------------ .github/workflows/antsibull-build.yml | 7 +++- .github/workflows/nox.yml | 47 +++++++++++++++++++++++++++ .yamllint | 15 +++++++++ 10/collection-meta.yaml | 2 +- 8/collection-meta.yaml | 2 +- 9/collection-meta.yaml | 2 +- README.md | 4 +++ noxfile.py | 10 ++++++ 10 files changed, 110 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/nox.yml create mode 100644 .yamllint diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2f4ff900d8..f0e426e155 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,6 @@ --- # Copyright (c) Ansible Project -# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later version: 2 diff --git a/.github/workflows/ansible-release.yml b/.github/workflows/ansible-release.yml index 172bde4ecf..a7c816454a 100644 --- a/.github/workflows/ansible-release.yml +++ b/.github/workflows/ansible-release.yml @@ -1,5 +1,10 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + name: Release Ansible package -on: +'on': workflow_dispatch: inputs: ansible-version: @@ -142,26 +147,25 @@ jobs: id-token: write steps: + - name: Ensure that the PR was merged + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ needs.build.outputs.pr_url }} + run: | + STATE="$(gh pr view "${PR_URL}" --json state --template "{{.state}}")" + if [ "${STATE}" != "MERGED" ]; then + echo "::error ::The state of PR ${PR_URL} must be MERGED, not ${STATE}" + exit 1 + fi + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: sdist-and-wheel + path: dist/ - - name: Ensure that the PR was merged - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_URL: ${{ needs.build.outputs.pr_url }} - run: | - STATE="$(gh pr view "${PR_URL}" --json state --template "{{.state}}")" - if [ "${STATE}" != "MERGED" ]; then - echo "::error ::The state of PR ${PR_URL} must be MERGED, not ${STATE}" - exit 1 - fi - - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: sdist-and-wheel - path: dist/ - - - name: Upload Ansible sdist and wheel to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Upload Ansible sdist and wheel to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 # git-tag job creates the git tag @@ -174,7 +178,6 @@ jobs: contents: write steps: - - name: Check out ansible-build-data uses: actions/checkout@v4 with: diff --git a/.github/workflows/antsibull-build.yml b/.github/workflows/antsibull-build.yml index 13d011a2ab..2d635c6c7b 100644 --- a/.github/workflows/antsibull-build.yml +++ b/.github/workflows/antsibull-build.yml @@ -1,5 +1,10 @@ +--- +# Copyright (c) Ansible Project +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + name: antsibull-build -on: +'on': push: branches: [main] pull_request: diff --git a/.github/workflows/nox.yml b/.github/workflows/nox.yml new file mode 100644 index 0000000000..a6ac83ec79 --- /dev/null +++ b/.github/workflows/nox.yml @@ -0,0 +1,47 @@ +--- +# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2023 Maxwell G