Skip to content

Commit

Permalink
Add linting workflow with yamllint. Fix linting issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Apr 27, 2024
1 parent 40b6bfe commit 6be128d
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
43 changes: 23 additions & 20 deletions .github/workflows/ansible-release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -142,25 +147,24 @@ jobs:
id-token: write

steps:
- name: Ensure that the PR was merged
env:
PR_URL: ${{ needs.build.outputs.create-pr }}
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:
PR_URL: ${{ needs.build.outputs.create-pr }}
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

Expand All @@ -173,7 +177,6 @@ jobs:
contents: write

steps:

- name: Check out ansible-build-data
uses: actions/checkout@v4
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/antsibull-build.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# 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: Lint repository
'on':
push:
branches: [main]
pull_request:
branches: [main]
# Run once per week (Thursday at 04:00 UTC)
schedule:
- cron: '0 4 * * 4'

jobs:
yamllint:
name: Run yamllint
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Check out ansible-build-data
uses: actions/checkout@v4

- name: Install yamllint
run: |
pip install yamllint
- name: Lint YAML files
run: |
yamllint .
15 changes: 15 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# 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

extends: default

rules:
line-length: disable

ignore:
- /.nox/
- /*/ansible-*.yaml
- /*/changelog.yaml
- /*/galaxy-requirements.yaml
2 changes: 1 addition & 1 deletion 10/collection-meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ collections:
- alinabuzachis
- GomathiselviS
- abikouo
- komaldesai13
- komaldesai13
repository: /~https://github.com/ansible-collections/vmware.vmware_rest
cisco.dnac:
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion 8/collection-meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ collections:
- alinabuzachis
- GomathiselviS
- abikouo
- komaldesai13
- komaldesai13
repository: /~https://github.com/ansible-collections/vmware.vmware_rest
cisco.dnac:
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion 9/collection-meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ collections:
- alinabuzachis
- GomathiselviS
- abikouo
- komaldesai13
- komaldesai13
repository: /~https://github.com/ansible-collections/vmware.vmware_rest
cisco.dnac:
maintainers:
Expand Down

0 comments on commit 6be128d

Please sign in to comment.