GetDeployKeyByRepo returns deploy key by given public key ID and repository ID.
(keyID, repoID int64)
| 716 | |
| 717 | // GetDeployKeyByRepo returns deploy key by given public key ID and repository ID. |
| 718 | func GetDeployKeyByRepo(keyID, repoID int64) (*DeployKey, error) { |
| 719 | key := &DeployKey{ |
| 720 | KeyID: keyID, |
| 721 | RepoID: repoID, |
| 722 | } |
| 723 | has, err := x.Get(key) |
| 724 | if err != nil { |
| 725 | return nil, err |
| 726 | } else if !has { |
| 727 | return nil, ErrDeployKeyNotExist{args: map[string]any{"keyID": keyID, "repoID": repoID}} |
| 728 | } |
| 729 | return key, nil |
| 730 | } |
| 731 | |
| 732 | // UpdateDeployKey updates deploy key information. |
| 733 | func UpdateDeployKey(key *DeployKey) error { |