feat(actions): PullRequest merge action (#24823)

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
This commit is contained in:
Michael Crenshaw
2025-10-02 13:31:13 -04:00
committed by GitHub
parent fb9d9747bd
commit 3ee16c0860
6 changed files with 102 additions and 0 deletions

View File

@@ -59,6 +59,7 @@
- [numaplane.numaproj.io/PipelineRollout/pause](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/numaplane.numaproj.io/PipelineRollout/actions/pause/action.lua)
- [numaplane.numaproj.io/PipelineRollout/unpause-fast](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/numaplane.numaproj.io/PipelineRollout/actions/unpause-fast/action.lua)
- [numaplane.numaproj.io/PipelineRollout/unpause-gradual](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/numaplane.numaproj.io/PipelineRollout/actions/unpause-gradual/action.lua)
- [promoter.argoproj.io/PullRequest/merge](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/promoter.argoproj.io/PullRequest/actions/merge/action.lua)
- [source.toolkit.fluxcd.io/Bucket/reconcile](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/source.toolkit.fluxcd.io/Bucket/actions/reconcile/action.lua)
- [source.toolkit.fluxcd.io/Bucket/resume](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/source.toolkit.fluxcd.io/Bucket/actions/resume/action.lua)
- [source.toolkit.fluxcd.io/Bucket/suspend](https://github.com/argoproj/argo-cd/blob/master/resource_customizations/source.toolkit.fluxcd.io/Bucket/actions/suspend/action.lua)

View File

@@ -0,0 +1,17 @@
discoveryTests:
- inputPath: testdata/open-pr.yaml
result:
- name: merge
disabled: false
iconClass: fa fa-fw fa-code-merge
displayName: Merge PR
- inputPath: testdata/merged-pr.yaml
result:
- name: merge
disabled: true
iconClass: fa fa-fw fa-code-merge
displayName: Merge PR
actionTests:
- action: merge
inputPath: testdata/open-pr.yaml
expectedOutputPath: testdata/merged-pr.yaml

View File

@@ -0,0 +1,8 @@
local actions = {}
actions["merge"] = {
["iconClass"] = "fa fa-fw fa-code-merge",
["disabled"] = obj.spec.state ~= "open",
["displayName"] = "Merge PR"
}
return actions

View File

@@ -0,0 +1,2 @@
obj.spec.state = "merged"
return obj

View File

@@ -0,0 +1,37 @@
apiVersion: promoter.argoproj.io/v1alpha1
kind: PullRequest
metadata:
finalizers:
- pullrequest.promoter.argoporoj.io/finalizer
labels:
promoter.argoproj.io/change-transfer-policy: promotion-strategy-wave-0-west-24b5855
promoter.argoproj.io/environment: wave-0-west
promoter.argoproj.io/promotion-strategy: promotion-strategy
name: test-org-test-repo-wave-0-west-next-wave-0-west-ac5b3e8c
namespace: gitops-promoter
spec:
commit:
message: >
Promote 89752 to `wave/0/west`
description: >-
This PR is promoting the environment branch `wave/0/west` which is currently
on dry sha bc0df509c35ec9ee4268f3fb0b514bafe26f0ee5 to dry sha
897529bb51f3b8ac7482071d26d2947c1f25dc16.
gitRepositoryRef:
name: test-repo
sourceBranch: wave/0/west-next
state: merged
targetBranch: wave/0/west
title: Promote 89752 to `wave/0/west`
status:
conditions:
- lastTransitionTime: '2025-10-01T18:18:26Z'
message: Reconciliation succeeded
observedGeneration: 5
reason: ReconciliationSuccess
status: 'True'
type: Ready
id: '2986'
prCreationTime: '2025-10-01T18:18:25Z'
state: open
url: https://git.example.com/test-org/test-repo/pull/2986

View File

@@ -0,0 +1,37 @@
apiVersion: promoter.argoproj.io/v1alpha1
kind: PullRequest
metadata:
finalizers:
- pullrequest.promoter.argoporoj.io/finalizer
labels:
promoter.argoproj.io/change-transfer-policy: promotion-strategy-wave-0-west-24b5855
promoter.argoproj.io/environment: wave-0-west
promoter.argoproj.io/promotion-strategy: promotion-strategy
name: test-org-test-repo-wave-0-west-next-wave-0-west-ac5b3e8c
namespace: gitops-promoter
spec:
commit:
message: >
Promote 89752 to `wave/0/west`
description: >-
This PR is promoting the environment branch `wave/0/west` which is currently
on dry sha bc0df509c35ec9ee4268f3fb0b514bafe26f0ee5 to dry sha
897529bb51f3b8ac7482071d26d2947c1f25dc16.
gitRepositoryRef:
name: test-repo
sourceBranch: wave/0/west-next
state: open
targetBranch: wave/0/west
title: Promote 89752 to `wave/0/west`
status:
conditions:
- lastTransitionTime: '2025-10-01T18:18:26Z'
message: Reconciliation succeeded
observedGeneration: 5
reason: ReconciliationSuccess
status: 'True'
type: Ready
id: '2986'
prCreationTime: '2025-10-01T18:18:25Z'
state: open
url: https://git.example.com/test-org/test-repo/pull/2986