Skip to content

Commit

Permalink
fix: working with new changes with secrets/allowEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
Claire.Nicholas authored and Claire.Nicholas committed Jan 29, 2024
1 parent 40ac2f8 commit 69b1c5e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/elm/Pages/RepoSettings.elm
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,12 @@ events repo msg =
, div [ class "form-controls", class "-two-col" ]
[ checkbox "Branch"
"allow_push_delete_branch"
allowEvents.push.branch
allowEvents.push.delete_branch
<|
msg repo.org repo.name repo "allow_push_delete_branch"
, checkbox "Tag"
"allow_push_delete_tag"
allowEvents.push.tag
allowEvents.push.delete_tag
<|
msg repo.org repo.name repo "allow_push_delete_tag"
]
Expand Down
13 changes: 13 additions & 0 deletions src/elm/Pages/Secrets/Form.elm
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,19 @@ viewEventsSelect secret model =
<|
OnChangeEvent "allow_comment_edited"
]
, strong [ class "settings-subtitle" ] [ text "Delete" ]
, div [ class "form-controls", class "-two-col-secrets" ]
[ checkbox "Branch"
"allow_push_delete_branch"
secret.allowEvents.push.delete_branch
<|
OnChangeEvent "allow_push_delete_branch"
, checkbox "Tag"
"allow_push_delete_tag"
secret.allowEvents.push.delete_tag
<|
OnChangeEvent "allow_push_delete_tag"
]
]
scheduleOption
)
Expand Down
6 changes: 6 additions & 0 deletions src/elm/Pages/Secrets/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ updateSecretEvents sform field value =

"allow_push_tag" ->
{ sform | allowEvents = { events | push = { pushActions | tag = value } } }

"allow_push_delete_branch" ->
{ sform | allowEvents = { events | push = { pushActions | delete_branch = value } } }

"allow_push_delete_tag" ->
{ sform | allowEvents = { events | push = { pushActions | delete_tag = value } } }

"allow_pull_opened" ->
{ sform | allowEvents = { events | pull = { pullActions | opened = value } } }
Expand Down
2 changes: 2 additions & 0 deletions src/elm/Pages/Secrets/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ allowEventsToList events =
[]
|> appendLabel events.push.branch "push"
|> appendLabel events.push.tag "tag"
|> appendLabel events.push.delete_branch "delete:branch"
|> appendLabel events.push.delete_tag "delete:tag"
|> appendLabel events.pull.opened "pull_request:opened"
|> appendLabel events.pull.synchronize "pull_request:synchronize"
|> appendLabel events.pull.edited "pull_request:edited"
Expand Down
2 changes: 1 addition & 1 deletion src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ secretToKey secret =

defaultSecretAllowEvents : AllowEvents
defaultSecretAllowEvents =
{ push = { branch = True, tag = True }, pull = defaultPullActionsPayload Nothing, deploy = { created = True }, comment = defaultCommentActionsPayload Nothing, schedule = defaultScheduleActionsPayload Nothing }
{ push = { branch = True, tag = True, delete_branch = True, delete_tag = True }, pull = defaultPullActionsPayload Nothing, deploy = { created = True }, comment = defaultCommentActionsPayload Nothing, schedule = defaultScheduleActionsPayload Nothing }


decodeSecret : Decoder Secret
Expand Down

0 comments on commit 69b1c5e

Please sign in to comment.