Adjust GitHub CI to run on pushes to main and feature only #11087

Open
opened 2025-12-29 21:40:08 +01:00 by adam · 4 comments
Owner

Originally created by @pheus on GitHub (Apr 25, 2025).

Proposed Changes

  • Update the CI workflow configuration to limit the push event triggers to only the main and feature branches.
  • Maintain the current trigger settings for pull_request events.

Justification

The current configuration causes the CI workflow to run twice on each Pull Request (once for the pull_request event and once for the push event). By restricting the push event trigger to only the essential main and feature branches, we can reduce redundant CI runs and improve efficiency. This setup ensures that individual pull requests still benefit from the necessary CI checks without unnecessary duplication.

Originally created by @pheus on GitHub (Apr 25, 2025). ### Proposed Changes - Update the CI workflow configuration to limit the `push` event triggers to only the `main` and `feature` branches. - Maintain the current trigger settings for `pull_request` events. ### Justification The current configuration causes the CI workflow to run twice on each Pull Request (once for the `pull_request` event and once for the `push` event). By restricting the `push` event trigger to only the essential `main` and `feature` branches, we can reduce redundant CI runs and improve efficiency. This setup ensures that individual pull requests still benefit from the necessary CI checks without unnecessary duplication.
adam added the type: housekeepingstatus: backlog labels 2025-12-29 21:40:08 +01:00
Author
Owner

@pheus commented on GitHub (Apr 25, 2025):

I noticed that this template is intended primarily for maintainers, and I apologize in advance if this issue doesn't belong here. However, I felt this suggestion didn't fit neatly as a feature request or a bug report.

Please feel free to close this issue if it doesn't align with the project's guidelines or priorities. Thank you for considering it, and for all the effort you put into maintaining this fantastic project!

@pheus commented on GitHub (Apr 25, 2025): I noticed that this template is intended primarily for maintainers, and I apologize in advance if this issue doesn't belong here. However, I felt this suggestion didn't fit neatly as a feature request or a bug report. Please feel free to close this issue if it doesn't align with the project's guidelines or priorities. Thank you for considering it, and for all the effort you put into maintaining this fantastic project!
Author
Owner

@jeremystretch commented on GitHub (Apr 28, 2025):

I think there's a benefit (albeit modest) of forcing CI to run for all branches. Is there a benefit of making this change beyond some efficiency improvements?

@jeremystretch commented on GitHub (Apr 28, 2025): I think there's a benefit (albeit modest) of forcing CI to run for all branches. Is there a benefit of making this change beyond some efficiency improvements?
Author
Owner

@pheus commented on GitHub (Apr 28, 2025):

Actually, it mainly improves efficiency, reduces GitHub Actions usage and simplifies CI statuses.

However, you could limit the redundant runs to only internal pushes:

name: CI

on:
  push:
  pull_request:

jobs:
  build:
    # Run the job if:
    # - It's a pull_request, or
    # - It's a push from the base repository (not a fork)
    if: github.event_name != 'push' || github.repository == github.event.repository.full_name
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

This is just a suggestion - feel free to mark it as “not planned” if you’d prefer to stick with the current approach.

@pheus commented on GitHub (Apr 28, 2025): Actually, it mainly improves efficiency, reduces GitHub Actions usage and simplifies CI statuses. However, you could limit the redundant runs to only internal pushes: ```yaml name: CI on: push: pull_request: jobs: build: # Run the job if: # - It's a pull_request, or # - It's a push from the base repository (not a fork) if: github.event_name != 'push' || github.repository == github.event.repository.full_name runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 ``` This is just a suggestion - feel free to mark it as “not planned” if you’d prefer to stick with the current approach.
Author
Owner

@arthanson commented on GitHub (May 1, 2025):

This needs further research and should be consistent across projects.

@arthanson commented on GitHub (May 1, 2025): This needs further research and should be consistent across projects.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11087