Skip to content

Add 'Open PR' as a new Action type #267

@DerDennisOP

Description

@DerDennisOP

Follow-up to #262 (Gradient Actions). The original issue called this out as explicitly out of scope:

Open PR (with e.g. new flake.lock) (currently out of scope new issue needs to be created)

Goal

Add a new action type alongside send_mail / send_web_request / forge_status_report:

  • Open PR — when fired, opens a pull request against the project's repo on its forge.

Use case

Primary motivation: automated flake.lock updates. A scheduled trigger runs an evaluation with refreshed inputs; on success, the Open PR action commits the new lockfile and opens a PR via the forge API.

Scope sketch

  • Only Opens PR if every flake input overwrite had same url enable, or in other words if no overwrite with url set exisist
  • New ActionConfig::OpenPr { integration_id, branch_pattern, title_template, body_template } variant, references an outbound integration row (kind=1) the same way forge_status_report does.
  • Executor: clones (or fetches) the project repo, applies a generator-provided patch (initially: paste the artifact-produced flake.lock from the build), commits to a new branch, pushes, opens PR via the forge API. Reuses existing forge integration credentials.
  • Probably restricted to a fixed event set (e.g. build.completed with an evaluation that produced a lockfile artifact) — similar to how forge_status_report has fixed events. Spec discussion needed.
  • Frontend: new radio option in the action form; type-specific config fields (integration dropdown, branch pattern, title/body templates).
  • Nix: extend actionType enum with open_pr + corresponding config shape.
  • Docs: docs/src/usage/actions.md gets a new section.

Dependencies

  • Requires a way for builds to surface specific files (e.g. flake.lock) as artifacts the action can consume. May need a separate issue for the artifact-extraction side if not already covered.
  • Forge API support for PR creation per forge type (GitHub, Gitea/Forgejo, GitLab). The existing reporters in core::ci::reporter already handle status reports — PR creation is a different API surface and needs new reporter methods.

Out of scope

  • Diff generation strategies beyond "consume a build artifact" (e.g. running custom scripts to produce a patch). v1 scope: artifact-based only.
  • Auto-merge / auto-rebase of opened PRs. Just open; humans review.

Related: #262

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmediumMedium severity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions