Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

PRs from branches in the same repository trigger both push and pull_request events, causing duplicate workflow runs.

Changes

Modified .github/workflows/main.yml to restrict push triggers to the main branch only:

# Before
on: [push, pull_request]

# After
on:
  push:
    branches:
      - main
  pull_request:

This ensures:

  • PRs run once on pull_request events
  • Main branch runs once on push events (post-merge)
  • semantic-release job continues to work correctly
Original prompt

This section details on the original issue you should resolve

<issue_title>[bug] needs to fix CI for strange duplicated checks in PR</issue_title>
<issue_description>The following duplicated CI checks ran in this open PR: #508

failing checks
[main / test (^18) (push)](https://github.com/casbin/node-casbin/actions/runs/19272050250/job/55102857598?pr=508)
main / test (^18) (push)Failing after 9s
[main / test (^20) (pull_request)](https://github.com/casbin/node-casbin/actions/runs/19272051183/job/55102867257?pr=508)
main / test (^20) (pull_request)Failing after 4s
[main / test (^20) (push)](https://github.com/casbin/node-casbin/actions/runs/19272050250/job/55102857620?pr=508)
main / test (^20) (push)Failing after 5s
[main / test (^22) (pull_request)](https://github.com/casbin/node-casbin/actions/runs/19272051183/job/55102867274?pr=508)
main / test (^22) (pull_request)Failing after 9s

I think for an open state PR, it should not run "XXX (push)" checks, right? It should run for the git push after PR merge?
Need to fix the CI.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 11, 2025
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@nomeguy nomeguy marked this pull request as ready for review November 11, 2025 16:32
Copilot AI changed the title [WIP] Fix CI for duplicated checks in PR Fix duplicate CI runs on pull requests Nov 11, 2025
Copilot AI requested a review from nomeguy November 11, 2025 16:38
@nomeguy nomeguy changed the title Fix duplicate CI runs on pull requests feat: fix duplicate CI runs on pull requests Nov 11, 2025
@nomeguy nomeguy merged commit a1f3382 into master Nov 11, 2025
14 of 17 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 8, 2025
# [5.42.0](v5.41.0...v5.42.0) (2025-12-08)

### Features

* configure CI workflow to trigger on master branch ([#521](#521)) ([02ec045](02ec045))
* fix duplicate CI runs on pull requests ([#513](#513)) ([67ab8ee](67ab8ee))
* fix escapeAssertion to preserve string literals ([#514](#514)) ([7801732](7801732))
* Support multiple policy definitions (p, p2) ([#518](#518)) ([1b1f1bb](1b1f1bb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] needs to fix CI for strange duplicated checks in PR

3 participants