Skip to content

Commit

Permalink
workflows check
Browse files Browse the repository at this point in the history
  • Loading branch information
l0uden committed Jul 19, 2024
1 parent 932c8ec commit d581859
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/checks-vizro-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
branches: [main]
paths:
- "vizro-core/**"
pull_request:
pull_request_target:
branches:
- "main"
paths:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/checks-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Worflows check

defaults:
run:
working-directory: vizro

on:
push:
branches: [main]
pull_request:
branches:
- main

env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1
PYTHON_VERSION: "3.11"

jobs:
lint-vizro-all:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Workflows check
run: |
cd .github/workflows
python ../../tools/yaml_check.py
27 changes: 27 additions & 0 deletions tools/yaml_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import yaml
import os
import json


def yaml_reader(filepath):
for file in filepath:
with open(file, "rb") as f:
data = yaml.safe_load(f)
data_str = json.dumps(data)
if "pull_request_target" in data_str:
print(f"{file} contains pull_request_target")
failed_list.append(file)


def failed_list_check(failed_list):
if failed_list:
return exit(1)
else:
pass


if __name__ == "__main__":
filepath = os.listdir()
failed_list = []
yaml_reader(filepath)
failed_list_check(failed_list)

0 comments on commit d581859

Please sign in to comment.