From 15c6a8fd7e1943a4dee9cf7ee05d3cb15328ddd0 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:01:48 -0400 Subject: [PATCH 1/9] Workflow dispatch on CI --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b31cfb58..401ad33e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,7 @@ name: Test and build on: push: branches: [ "main" ] - pull_request: - branches: [ "main" ] + workflow_dispatch: jobs: pyTest: From 9782d95e30762f6ecd0a6f7fd1f06460c08c65a4 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:03:12 -0400 Subject: [PATCH 2/9] More changes --- .github/dependabot.yml | 2 +- .github/workflows/codeql.yml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 77f5d5e5..0c0695c6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,5 +8,5 @@ updates: - package-ecosystem: "pip" # See documentation for possible values directory: "/" # Location of package manifests schedule: - interval: "daily" + interval: "weekly" open-pull-requests-limit: 10 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 83873b36..fc9dba56 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -14,9 +14,7 @@ name: "CodeQL" on: push: branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] + workflow_dispatch: schedule: - cron: '31 18 * * 1' From 72ac790cee4b34ed73619559a25884f0d7da39e9 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:10:38 -0400 Subject: [PATCH 3/9] Test --- .github/workflows/ci.yml | 4 ++++ .github/workflows/codeql.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 401ad33e..507aed1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,10 @@ on: push: branches: [ "main" ] workflow_dispatch: + inputs: + pr_branch: + description: 'Branch to run CI on' + required: true jobs: pyTest: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fc9dba56..96d5d563 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -15,6 +15,10 @@ on: push: branches: [ "main" ] workflow_dispatch: + inputs: + pr_branch: + description: 'Branch to run CI on' + required: true schedule: - cron: '31 18 * * 1' From 09fdc7db0c4786a525e2ec6abdb1a31474c1146e Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:10:52 -0400 Subject: [PATCH 4/9] Add file --- .github/workflows/comment-trigger.yml | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/comment-trigger.yml diff --git a/.github/workflows/comment-trigger.yml b/.github/workflows/comment-trigger.yml new file mode 100644 index 00000000..64263b2a --- /dev/null +++ b/.github/workflows/comment-trigger.yml @@ -0,0 +1,34 @@ +# .github/workflows/comment-trigger.yml +name: PR Comment Trigger + +on: + issue_comment: + types: [created] + +jobs: + trigger-ci: + if: github.event.comment.body == '/run-ci' && github.event.issue.pull_request != null + runs-on: ubuntu-latest + + permissions: + contents: read + actions: write + issues: read + pull-requests: read + + steps: + - name: Extract PR branch name + id: pr + run: | + pr_url="${{ github.event.issue.pull_request.url }}" + branch=$(gh api "$pr_url" --jq '.head.ref') + echo "branch=$branch" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Trigger CI workflow + run: | + gh workflow run ci.yml -f pr_branch=${{ steps.pr.outputs.branch }} -r ${{ steps.pr.outputs.branch }} + gh workflow run codeql.yml -f pr_branch=${{ steps.pr.outputs.branch }} -r ${{ steps.pr.outputs.branch }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 51f2324ea739c3221ff0123f17a1aad97418578b Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:18:04 -0400 Subject: [PATCH 5/9] Try more AI code --- .github/workflows/ci.yml | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 507aed1f..212cac9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,14 +3,16 @@ name: Test and build on: push: branches: [ "main" ] - workflow_dispatch: - inputs: - pr_branch: - description: 'Branch to run CI on' - required: true + pull_request: + branches: [ "main" ] + types: [opened, synchronize, reopened, labeled, unlabeled, edited] jobs: pyTest: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -34,6 +36,10 @@ jobs: python3.11 -m pytest tests/ -p no:warnings black: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -51,6 +57,10 @@ jobs: black $(git rev-parse --show-toplevel) --check pyLint: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -68,6 +78,10 @@ jobs: pylint $(git ls-files '*.py') lineEndingCheck: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -84,6 +98,10 @@ jobs: fi flake8: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -101,6 +119,10 @@ jobs: flake8 $(git rev-parse --show-toplevel) isort: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -118,6 +140,10 @@ jobs: isort --check-only $(git rev-parse --show-toplevel)/ --profile black containerBuild: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') runs-on: ubuntu-latest needs: - pyTest From e96ea6a549472fa15d21473c958fe6e44cc65343 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:20:54 -0400 Subject: [PATCH 6/9] Update CodeQL --- .github/workflows/codeql.yml | 12 ++++++---- .github/workflows/comment-trigger.yml | 34 --------------------------- 2 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/comment-trigger.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 96d5d563..9583ca8f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -14,15 +14,17 @@ name: "CodeQL" on: push: branches: [ "main" ] - workflow_dispatch: - inputs: - pr_branch: - description: 'Branch to run CI on' - required: true + pull_request: + branches: [ "main" ] + types: [opened, synchronize, reopened, labeled, unlabeled, edited] schedule: - cron: '31 18 * * 1' jobs: + if: | + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') analyze: name: Analyze runs-on: ubuntu-latest diff --git a/.github/workflows/comment-trigger.yml b/.github/workflows/comment-trigger.yml deleted file mode 100644 index 64263b2a..00000000 --- a/.github/workflows/comment-trigger.yml +++ /dev/null @@ -1,34 +0,0 @@ -# .github/workflows/comment-trigger.yml -name: PR Comment Trigger - -on: - issue_comment: - types: [created] - -jobs: - trigger-ci: - if: github.event.comment.body == '/run-ci' && github.event.issue.pull_request != null - runs-on: ubuntu-latest - - permissions: - contents: read - actions: write - issues: read - pull-requests: read - - steps: - - name: Extract PR branch name - id: pr - run: | - pr_url="${{ github.event.issue.pull_request.url }}" - branch=$(gh api "$pr_url" --jq '.head.ref') - echo "branch=$branch" >> "$GITHUB_OUTPUT" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Trigger CI workflow - run: | - gh workflow run ci.yml -f pr_branch=${{ steps.pr.outputs.branch }} -r ${{ steps.pr.outputs.branch }} - gh workflow run codeql.yml -f pr_branch=${{ steps.pr.outputs.branch }} -r ${{ steps.pr.outputs.branch }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e153d6417a7504c9fb5bfb546228ac91c7cef9e6 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:24:17 -0400 Subject: [PATCH 7/9] Update if statement --- .github/workflows/ci.yml | 84 +++++++++++++++++++++++++++--------- .github/workflows/codeql.yml | 12 ++++-- 2 files changed, 72 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 212cac9c..629bd7c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,15 @@ on: jobs: pyTest: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -37,9 +43,15 @@ jobs: black: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -58,9 +70,15 @@ jobs: pyLint: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -79,9 +97,15 @@ jobs: lineEndingCheck: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -99,9 +123,15 @@ jobs: flake8: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -120,9 +150,15 @@ jobs: isort: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -141,9 +177,15 @@ jobs: containerBuild: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) runs-on: ubuntu-latest needs: - pyTest diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9583ca8f..a9472b76 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -22,9 +22,15 @@ on: jobs: if: | - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'push' || + ( + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) + ) analyze: name: Analyze runs-on: ubuntu-latest From fcc71886cdcc5215044417f2b8e505903c56dd18 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:24:46 -0400 Subject: [PATCH 8/9] Fix codeql --- .github/workflows/codeql.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a9472b76..002b29f7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -21,17 +21,17 @@ on: - cron: '31 18 * * 1' jobs: - if: | - github.event_name == 'push' || - ( - github.event_name == 'pull_request' && + analyze: + if: | + github.event_name == 'push' || ( - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || - contains(join(github.event.pull_request.labels.*.name), 'run-ci') + github.event_name == 'pull_request' && + ( + contains(github.event.pull_request.title, '[run ci]') || + contains(github.event.pull_request.body, '[run ci]') || + contains(join(github.event.pull_request.labels.*.name), 'run-ci') + ) ) - ) - analyze: name: Analyze runs-on: ubuntu-latest permissions: From bbad3106216e5417e41bb5dfa375f3ee291c91bd Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 3 May 2025 23:27:33 -0400 Subject: [PATCH 9/9] Fix PR types --- .github/workflows/ci.yml | 2 +- .github/workflows/codeql.yml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 629bd7c4..4db7c370 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - types: [opened, synchronize, reopened, labeled, unlabeled, edited] + types: [opened, labeled] jobs: pyTest: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 002b29f7..5b5cceb5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -16,7 +16,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - types: [opened, synchronize, reopened, labeled, unlabeled, edited] + types: [opened, labeled] schedule: - cron: '31 18 * * 1' @@ -27,8 +27,6 @@ jobs: ( github.event_name == 'pull_request' && ( - contains(github.event.pull_request.title, '[run ci]') || - contains(github.event.pull_request.body, '[run ci]') || contains(join(github.event.pull_request.labels.*.name), 'run-ci') ) )