From e53263068652cb14a9f7fd6a13a9a38e74b9d912 Mon Sep 17 00:00:00 2001 From: Troy Date: Wed, 27 Sep 2023 15:43:13 +0100 Subject: [PATCH] fix(RHTAPBUGS-763): run lint checks for prs Adds the workflow file to run lint checks for new PRs Also adds CODEOWNERS file Signed-off-by: Troy --- .github/CODEOWNERS | 8 +++++ .github/workflows/build_and_push_image.yaml | 1 + .github/workflows/lint.yaml | 33 +++++++++++++++++++++ .github/workflows/python.yaml | 3 +- 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/lint.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..5a1085ca --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,8 @@ +# This is a comment. +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# @redhat-appstudio/release-team will be requested for +# review when someone opens a pull request. +* @redhat-appstudio/release-team diff --git a/.github/workflows/build_and_push_image.yaml b/.github/workflows/build_and_push_image.yaml index 4c7328ee..35477f52 100644 --- a/.github/workflows/build_and_push_image.yaml +++ b/.github/workflows/build_and_push_image.yaml @@ -1,3 +1,4 @@ +--- name: Build and push image on: push: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..db915168 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,33 @@ +--- +name: Linters +'on': + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + workflow_dispatch: null +jobs: + yamllint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run yamllint + uses: frenck/action-yamllint@v1 + gitlint: + name: Run gitlint checks + runs-on: ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: '${{ github.event.pull_request.head.sha }}' + - name: Install gitlint into container + run: python -m pip install gitlint + - name: Run gitlint check + run: >- + gitlint --commits origin/${{ github.event.pull_request.base.ref + }}..HEAD diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index 1c6d925b..28ea1b24 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -1,3 +1,4 @@ +--- name: Python Checks for Pull Requests on: pull_request: @@ -16,7 +17,7 @@ jobs: - name: Setup python environment for flake8 check uses: actions/setup-python@v4 with: - python-version: "3.9" # Same as in Dockerfile + python-version: "3.9" # Same as in Dockerfile - name: flake8 Lint uses: py-actions/flake8@v2 - name: Run pytest