Skip to content

Development: Use existing builds for protected branches and improve PR lookup to avoid forked PR interference #10719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

egekocabas
Copy link
Member

@egekocabas egekocabas commented Apr 22, 2025

Motivation and Context

Our previous deployment logic had two key issues:

  • Redundant builds for protected branches
    When deploying protected branches like develop or main, which rely on the push event to trigger build.yml, we unnecessarily triggered a new build even when a successful one already existed. This led to wasted CI resources and longer deployment times.
  • Incorrect PR detection due to forked repositories
    When attempting to deploy a branch (e.g., develop), the workflow searched for any open PRs targeting develop. If a user had opened a PR from a fork (e.g., their forked repo’s develop branch), it matched the search query, leading to misaligned deployment behavior.

This PR addresses both issues by:

  • Checking for existing successful builds for protected branches and reusing them when available.
  • Updating PR lookup logic to only consider internal PRs (i.e., those where the source and target repos match), avoiding interference from forked repositories.

Description

  • Added a filter in the PR lookup logic to ensure only internal PRs (non-forked) are considered during deployment checks.
  • Introduced a mechanism to detect and use existing successful builds for protected branches (develop, main), skipping unnecessary rebuilds.

Example Runs

@egekocabas egekocabas temporarily deployed to artemis-test1.artemis.cit.tum.de April 22, 2025 09:53 — with GitHub Actions Inactive
@egekocabas egekocabas temporarily deployed to artemis-test7.artemis.cit.tum.de April 22, 2025 10:15 — with GitHub Actions Inactive
@egekocabas egekocabas changed the title fix: ignore forked prs Development: Ignore forked PRs and skip rebuilds for protected branches during deployment Apr 22, 2025
@egekocabas egekocabas changed the title Development: Ignore forked PRs and skip rebuilds for protected branches during deployment Development: Skip redundant builds for protected branches and ignore forked PRs Apr 22, 2025
@egekocabas egekocabas changed the title Development: Skip redundant builds for protected branches and ignore forked PRs Development: Use existing builds for protected branches and improve PR lookup to avoid forked PR interference Apr 22, 2025
@egekocabas egekocabas marked this pull request as ready for review April 22, 2025 10:46
@egekocabas egekocabas requested a review from a team as a code owner April 22, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Work In Progress
Development

Successfully merging this pull request may close these issues.

1 participant