Skip to content

Commit 4747ecc

Browse files
committed
add yamllint scaffold, and prettify variables.yaml
Signed-off-by: Jack Luar <[email protected]>
1 parent 17fcb97 commit 4747ecc

File tree

4 files changed

+195
-92
lines changed

4 files changed

+195
-92
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: ORFS variables.yaml tester and linter
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
docs-test-job:
8+
name: 'Tests for variables.yaml'
9+
runs-on: ubuntu-latest
10+
container:
11+
image: openroad/ubuntu-cpp20
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
submodules: 'recursive'
17+
- name: Run YAML script
18+
run: |
19+
python3 flow/scripts/generate-variable-docs.py
20+
- name: Run YAML Lint
21+
run: |
22+
pip install yamllint==1.35.1
23+
yamllint flow/scripts/variables.yaml
24+
25+
docs-pr-update:
26+
name: 'Create PR to update ORFS FlowVariables.md'
27+
needs:
28+
- docs-test-job
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
- name: Run generate-variable-docs.py
34+
run: |
35+
python3 flow/scripts/generate-variable-docs.py
36+
- name: Create branch if diff exists
37+
id: docs-update
38+
run: |
39+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
40+
git config --local user.name "github-actions[bot]"
41+
if [ -n "$(git status --porcelain)" ]; then
42+
echo "has_update=true" >> "$GITHUB_OUTPUT"
43+
else
44+
echo "has_update=false" >> "$GITHUB_OUTPUT"
45+
fi
46+
git add .
47+
git commit --signoff -m "[Docs]: Update ORFS FlowVariables.md"
48+
- name: Only push if not master
49+
if: "github.event.client_payload.branch != 'master'"
50+
id: remote-update-pr
51+
run: |
52+
git push origin "HEAD:refs/pull/${{ github.event.client_payload.branch }}/head"
53+
- name: Create docs update PR
54+
if: "steps.remote-update.outputs.has_update == 'true' && github.event.client_payload.branch == 'master'"
55+
uses: peter-evans/create-pull-request@v5
56+
with:
57+
token: ${{ github.token }}
58+
signoff: true
59+
delete-branch: true
60+
title: "[BOT] Update ORFS variables"
61+
reviewers: |
62+
vvbandeira
63+
maliberty
64+
draft: true
65+
branch: bot-update-variables
66+
commit-message: |
67+
[BOT] Update ORFS variables

.yamllint

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
extends: default
2+
3+
rules:
4+
# General formatting
5+
indentation:
6+
level: error # options: 'error' (strict), 'warning' (less strict)
7+
spaces: 2 # number of spaces per indentation level
8+
line-length:
9+
max: 120 # maximum allowed length for lines
10+
level: warning
11+
allow-non-breakable-words: false # non-breakable words exceeding line-length
12+
13+
# Document structure
14+
document-start:
15+
level: error # documents should start with '---'
16+
17+
# Trailing spaces
18+
trailing-spaces:
19+
level: error # no trailing spaces allowed
20+
21+
# Comments
22+
comments:
23+
level: warning
24+
require-starting-space: true # comments should have a space after '#'
25+
26+
# Special characters
27+
key-duplicates:
28+
level: error # duplicate keys are not allowed
29+
truthy:
30+
level: warning # warn on 'yes/no' and 'on/off'; prefer 'true/false'
31+
32+
# File properties
33+
empty-lines:
34+
max: 2 # no more than 2 consecutive empty lines
35+
level: warning
36+
new-line-at-end-of-file:
37+
level: warning # files should end with a newline

etc/DependencyInstaller.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _installCommon() {
2929
source /opt/rh/rh-python38/enable
3030
set -u
3131
fi
32-
local pkgs="pandas numpy firebase_admin click pyyaml"
32+
local pkgs="pandas numpy firebase_admin click pyyaml yamllint"
3333
if [[ $(id -u) == 0 ]]; then
3434
pip3 install --no-cache-dir -U $pkgs
3535
else

0 commit comments

Comments
 (0)