Commit Graph

10 Commits

Author SHA1 Message Date
DevTekVE
9a1e420fa7 ci: bugfix cancelling only when push to master or workflow dispatch.
Otherwise don't let it cancel as it seems that when running with pull_request_target we are with ref pointing to target and thus the cancel condition was being met
2025-04-20 14:19:31 +02:00
DevTekVE
d0c209575e ci: bugfix flipped contains check for pull requests 2025-04-20 14:06:24 +02:00
DevTekVE
511e4c5919 ci: update auto pr review config and split turst fork pr (#842)
* Updating auto pr labeler

* auto pr review revamp

* Leaving event as pull request :)

* Check permission

* add chore

* Bringing back as original
2025-04-20 13:34:24 +02:00
DevTekVE
898f30744f ci: avoid deadlock on dev-c3 branch build when PR labeled dev-c3 (#839)
* ci: enhance PR checks to validate individual check runs before merging and ignore reset-and-squash as candidate for fail

* reset and squash script shouldn't will be cancelled only if a push to master has been made which always should take priority. The rest will be put on hold to avoid parallel squash scripts running

* Set concurrencty at workflow level?

* Set concurrencty at workflow level?

* change trigger to pull_request to validate

* Reducing the types of "pull request" events

* Keep it as target

* Playing eith run name a little

* Change to pull request not target

* simplifying

* set to just pull request without target

* maintain as pull request target
2025-04-20 13:04:35 +02:00
DevTekVE
702a755307 CI: Update PR list query to exclude draft pull requests (#829) 2025-04-16 06:05:44 -04:00
DevTekVE
224f43b6fa CI: Improve dev-c3-new auto build (#825)
* force commit to force PR

* ci: add job to manage PR labels and remove trust label on new commits

* Add pull request trigger

* empty commit to test

* ci: update pull request label management logic and remove FORCE_RUN flag

* ci: update trust label management to use TRUST_FORK_PR_LABEL

* ci: update workflow to manage PR labels and adjust trigger conditions

* ci: rename jobs in workflow for consistency and clarity

* ci: add unleash-nightly-squash branch to workflow

* ci: add checkout step with GITHUB_TOKEN to workflow

* force wait

* what happens if negated the wait

* ci: add 'Wait for Tests' action to monitor workflow execution

* ci: update wait-for-tests action conditions and cleanup

* ci: refine conditions for managing PR labels and waiting for tests

* ci: enhance PR label conditions for workflow execution

* Cant use env on if

* maybe

* ci: update pull request workflow conditions and cleanup

* Missing end of line

* ci: rename workflow and update job name for clarity

* Cleaning

* ci: refine conditions for pull request handling in workflow

* ci: update handling of TRUST_FORK_LABEL in PR processing

* ci: remove fork trust warning from PR processing

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-04-15 15:53:29 -04:00
DevTekVE
b9d584245f ci: update squash script for external contributors (#811)
* Get head ref info

* Simpify adding the comment with the newest flagg by gh cli

* Dynamic origin

* Enhance PR processing: add label handling for forked PRs and improve variable naming

* Refactor PR label handling: use constant for trust-fork label and improve comments

* Fix remote addition in PR processing: change subprocess call to not check for errors

* Refactor PR comment handling: support multiple comments and improve clarity

* Refactor PR processing: streamline comment handling and improve error management

* Refactor add_pr_comments function: specify comments type as list of strings

* Maybe we don't prevent "behind" branches to be merged as lon as the PR itself is mergeable

* lint, leave me alone

---------

Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com>
2025-04-14 19:29:33 +02:00
DevTekVE
6b3f75bbf0 CI: refactor Squash and Merge with simplified branch merging (#726)
* Refactor squash and merge script for improved simplicity

Simplified the squash_and_merge.py script by replacing redundant utility functions and consolidating logic. Enhanced usability by aligning command-line arguments and leveraging streamlined git operations to improve maintainability and reliability.

* Fix argument names in squash PR script

Renamed CLI arguments from '--base' and '--source' to '--target' and '--base' to align with expected input format. This ensures the script runs correctly with proper argument mapping.

* Fix incorrect base branch argument in squash script

    Updated the `--base` argument to use `source_branch` instead of `branch` to ensure the squash script processes the correct base branch. Also adjusted the command to include `branch` as a separate argument for clarity and correctness.

* Reset to a clean state after squash error.

Add a `git reset --hard` command to ensure the repository returns to a clean state after encountering errors during the squash and merge process. This prevents lingering changes from affecting subsequent operations.

* Improve error handling in squash_and_merge_prs.py

Capture and display both stdout and stderr in error cases to provide more informative feedback. Adjust the PR comment to include available output for better debugging.

* Refactor PR squash process to enhance error handling.

Modify subprocess handling to use `result.returncode` for error checks instead of relying on exceptions. Consolidate error output retrieval and logging for better clarity, while maintaining the workflow for resetting changes on failure.

* Fix incorrect return in PR processing loop

Replaced `return` with `continue` to ensure all PRs in the loop are processed before exiting. This prevents premature termination of the function and ensures accurate success count reporting.

* Simplify subprocess output handling in squash_and_merge.py

Replaced labeled print statements with direct output of stdout and stderr. This change ensures cleaner logs and remains consistent with the function's purpose of output handling during subprocess execution.

* Update subprocess.run calls to use capture_output parameter

Replaced `stdout` and `stderr` with the `capture_output` parameter for cleaner and more concise subprocess handling. Also removed extraneous whitespace for improved code readability.

* testing moving the squash script given that it's called iteratively and switching branch might miss it

* format

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-03-29 21:54:49 +00:00
DevTekVE
245605dc55 ci: Add LFS configuration and GitLab SSH to squash & merge script (#725)
Integrate GitLab LFS handling by configuring LFS URLs and enabling SSH setup. This includes adding public GitLab keys and updating the workflow to support secure connections for LFS operations. Ensures proper handling of large files and seamless integration with GitLab.
2025-03-29 12:42:54 +01:00
DevTekVE
3e4be4a393 ci: Add branch reset workflow and improve squash script (#579)
* Add nightly branch reset workflow and improve squash script

Introduced a GitHub Actions workflow to reset and squash PRs nightly for the `master-dev-c3-new-test` branch. Enhanced `squash_and_merge.py` to handle more specific exit codes and `squash_and_merge_prs.py` to streamline PR processing. Updated argument handling in scripts and added validation for squash script execution.

* Forcing to show up

* UnForcing to show up

* Refactor branch handling to use inputs/environments directly

Removed intermediate step for setting branch variables and updated logic to use `inputs` or environment variables directly. Simplifies the workflow and improves maintainability by reducing redundancy and reliance on unnecessary outputs.

* Fix Python script invocation in CI workflow.

Replaced implicit script execution with an explicit `python3` command to ensure compatibility and consistency in the workflow. This change resolves potential issues with shell defaults or system configurations.

* Update branch reset logic in workflow script

Replaces checkout-based branch reset with deletion and recreation to ensure the target branch correctly points to the source branch. This change handles cases where the target branch may already exist.

* Refactor PR data handling to parse JSON input.

Updated the script to parse and handle PR data as JSON, ensuring proper data structure during processing. Adjusted functions to operate on parsed JSON instead of raw arguments for improved clarity and error handling.

* Refactor PR processing to streamline branch handling

Removed redundant `fetch_pr_branches` function and integrated branch fetching directly into `process_pr`. Simplified subprocess calls for clarity and added branch cleanup to prevent conflicts. This improves code maintainability and execution efficiency.

* Add PR number to squash and merge commit titles

This change appends the PR number to the title used in squash and merge commits, improving traceability and clarity in the commit history. The modification ensures easier identification of commits linked to specific pull requests.

* Enhance PR processing with sorting and additional checks

Implemented sorting of PRs by creation date and added checks for merge conflicts, commit data availability, and status check completion. Updated nightly squash script to provide detailed feedback via PR comments for skipped PRs. These changes improve the reliability and traceability of the merge process.

* Add traceback logging to error handling in squash_and_merge_prs

Enhanced error reporting by including full traceback details when an exception occurs in the `process_pr` function. This aids in debugging by providing more context on failures.

* Refactor and add debug output to PR merge check logic

Simplified multi-line statements into single lines for clarity and added debug `print` statements to log `merge_status` and its output. These changes enhance readability and facilitate debugging of the merge conflict check process.

* Add GITHUB_TOKEN to environment for CI workflow

Ensure the workflow has access to the GITHUB_TOKEN for authentication. This is necessary for interacting securely with the GitHub API during the CI process. Without this, some steps may fail due to lack of authorization.

* Enable scheduled workflow execution at midnight UTC

Reactivates the cron schedule for the workflow to run daily at midnight UTC. This ensures the workflow executes automatically without manual triggers, maintaining regular updates or checks.

* test

* Update workflow to trigger and monitor selfdrive tests

Replaced the direct triggering of the prebuilt workflow with a step to trigger and wait for the completion of selfdrive tests. Ensures prebuilt workflow runs only if selfdrive tests succeed, improving reliability of the CI process.

* Refine workflow trigger to fetch run URL and ID

Updated the workflow script to extract the run URL and derive the workflow ID from it. This ensures more accurate handling and tracking of GitHub Actions runs.

* Simplify selfdrive test triggering in workflow

Replaces custom script with a reusable GitHub Action to trigger and wait for selfdrive test completion. This improves maintainability and reduces complexity in the workflow file. Adjusts subsequent prebuilt workflow trigger to ensure compatibility.

* Remove duplicate prebuilt workflow trigger step

The redundant step for triggering the sunnypilot prebuilt workflow has been removed. This cleanup avoids unnecessary duplication and ensures a more streamlined workflow definition.

* Update selfdrive test trigger to use GitHub CLI commands

Replaced the third-party action with GitHub CLI for triggering and monitoring selfdrive tests. This change improves maintainability and reduces reliance on external dependencies. Updated related steps to ensure compatibility with the new approach.

* Add delay to ensure selfdrive tests workflow starts

Introduce a 120-second sleep before fetching the latest run ID to allow sufficient time for the selfdrive tests action to initialize. This prevents potential issues caused by attempting to retrieve the run ID too early.

* Improve push step to check for diffs before execution

Added logic to verify if there are differences between local and remote branches before attempting a push. This prevents unnecessary pushes and skips subsequent workflows when no changes are detected. Updated dependent steps to conditionally run based on the presence of changes.

* Update target branch and improve squash comment clarity

Renamed the default target branch from `master-dev-c3-new-test` to `nightly` in the workflow configuration. Enhanced squash process comments to dynamically reflect the `target_branch` value for better clarity and consistency.

* Add missing newline at end of file

Ensures the file complies with POSIX standards by including a newline at the end. This improves consistency and prevents potential issues with some tools or systems.

* Update default target branch and disable nightly schedule

Changed the default target branch to 'master-dev-c3-new' for workflow consistency. Commented out the nightly schedule to temporarily disable automated runs. No functional changes were made to other parts of the workflow.

* Refactored squash and merge scripts for improved PR handling

In this commit, significant updates have been made to the 'squash_and_merge.py' and 'squash_and_merge_prs.py' scripts related to how pull requests (PRs) are processed.

A 'source-branch' argument has been added to the argument parser. The merging command has been changed from 'merge' to 'rebase'.

The PR processing function has been refined. Specifically, PR validation is now a separate function confirming the conditions 'branch name', 'commit data', 'check pass status', and 'mergeability'. Now, any failures under these conditions result in skipping the PR with an appropriate warning.

The target branch is deleted if it exists, before a new one is created from the source branch. The squash script now runs with more structured arguments.

These changes generally improve PR handling in CI/CD pipelines, making them more efficient and error-resistant.

* Add 'PullRequest' to .codespellignore

This update includes 'PullRequest' in the .codespellignore file to prevent it from being flagged as a spelling error. It helps streamline code reviews and reduces false positives during spell checks.
2025-01-22 09:30:53 +01:00