From bf42f138a07ab6982dfdfce0e46f2cf3f5b5af91 Mon Sep 17 00:00:00 2001 From: bbhtt Date: Thu, 7 Nov 2024 14:02:10 +0530 Subject: [PATCH] Add python format and lint CI --- .github/actions/merge/entrypoint.py | 2 +- .github/scripts/archive_eol.py | 1 - .github/scripts/archive_orphan.py | 3 +-- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/actions/merge/entrypoint.py b/.github/actions/merge/entrypoint.py index 8ee48a6..dd4918e 100755 --- a/.github/actions/merge/entrypoint.py +++ b/.github/actions/merge/entrypoint.py @@ -17,7 +17,7 @@ from gql import Client, gql from gql.transport.requests import RequestsHTTPTransport gi.require_version("Json", "1.0") -from gi.repository import Json # noqa: E402 +from gi.repository import Json # noqa: E402 def set_protected_branch(token, repo, branch): diff --git a/.github/scripts/archive_eol.py b/.github/scripts/archive_eol.py index 9a0c3a1..ba6bc30 100644 --- a/.github/scripts/archive_eol.py +++ b/.github/scripts/archive_eol.py @@ -48,7 +48,6 @@ def get_eol_refs(arch: str, remote: str) -> set: def main() -> None: - token = os.environ["GITHUB_TOKEN"] g = github.Github(auth=github.Auth.Token(token)) diff --git a/.github/scripts/archive_orphan.py b/.github/scripts/archive_orphan.py index 56c58a1..389fa5d 100644 --- a/.github/scripts/archive_orphan.py +++ b/.github/scripts/archive_orphan.py @@ -10,13 +10,12 @@ from github.GithubException import ( def main() -> None: - token = os.environ["GITHUB_TOKEN"] g = github.Github(auth=github.Auth.Token(token)) org = g.get_organization("flathub") - excludes = {} + # excludes = {} earliest = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta( weeks=60 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c5665cc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: master + pull_request: + branches: master + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + + - name: Install dependencies + run: pip install --user ruff + + - name: Check format + run: find .github -name *.py -exec ruff format --check {} \; + + - name: Lint + run: find .github -name *.py -exec ruff check --output-format=github {} \;