Skip to content

Commit

Permalink
ci: add YAML linter (#31)
Browse files Browse the repository at this point in the history
Also, fix YAML lint issues
  • Loading branch information
ashishb authored Sep 18, 2024
1 parent 3ee6d5a commit a77328f
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 35 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/lint-yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Gabo (https://github.com/ashishb/gabo)
---
# Run this locally with act - https://github.com/nektos/act
# act -j lintYaml
name: Lint YAML

on: # yamllint disable-line rule:truthy
push:
branches: [main, master]
paths:
- '**.yml'
- '**.yaml'
- '.github/workflows/**.yml'
- '.github/workflows/**.yaml'
pull_request:
branches: [main, master]
paths:
- '**.yml'
- '**.yaml'
- '.github/workflows/**.yml'
- '.github/workflows/**.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lintYaml:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check YAML files with linter
uses: ibiqlik/action-yamllint@v3
with:
# All files under base dir
file_or_dir: "."
config_data: |
extends: default
yaml-files:
- '*.yaml'
- '*.yml'
rules:
document-start:
level: warning
line-length:
level: warning
new-line-at-end-of-file:
level: warning
trailing-spaces:
level: warning
38 changes: 19 additions & 19 deletions .github/workflows/lint.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
This workflow uses actions that are not certified by GitHub.
---
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Lint

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:

runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install dependencies
run: gem install mdl
- name: Run tests
run: |
# Lint - disable some rules - https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
mdl -r ~MD013,~MD029,~MD033 README.md
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install dependencies
run: gem install mdl
- name: Run tests
run: |
# Lint - disable some rules - https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
mdl -r ~MD013,~MD029,~MD033 README.md
33 changes: 17 additions & 16 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
Expand All @@ -9,27 +10,27 @@ name: Test

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install dependencies
run: gem install awesome_bot
- name: Run tests
run: |
# Some URLs could be flaky, try twice in case the first execution fails.
bash run_awesome_bot.sh || bash run_awesome_bot.sh
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Install dependencies
run: gem install awesome_bot
- name: Run tests
run: |
# Some URLs could be flaky, try twice in case the first execution fails.
bash run_awesome_bot.sh || bash run_awesome_bot.sh

0 comments on commit a77328f

Please sign in to comment.