checkTagProtection checks whether tag protection rulesets are enabled.
(client *api.Client, host, owner, repo string)
| 756 | |
| 757 | // checkTagProtection checks whether tag protection rulesets are enabled. |
| 758 | func checkTagProtection(client *api.Client, host, owner, repo string) []publishDiagnostic { |
| 759 | if client == nil { |
| 760 | return nil |
| 761 | } |
| 762 | apiPath, err := safeurl.JoinPath("repos", owner, repo, "rulesets") |
| 763 | if err != nil { |
| 764 | return nil |
| 765 | } |
| 766 | var rulesets []rulesetsResponse |
| 767 | if err := client.REST(host, "GET", apiPath.String(), nil, &rulesets); err != nil { |
| 768 | return nil |
| 769 | } |
| 770 | |
| 771 | for _, rs := range rulesets { |
| 772 | if rs.Target == "tag" && rs.Enforcement == "active" { |
| 773 | return nil |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | return []publishDiagnostic{{ |
| 778 | severity: "warning", |
| 779 | message: "no active tag protection rulesets found. Consider protecting tags to ensure immutable releases (Settings > Rules > Rulesets)", |
| 780 | }} |
| 781 | } |
| 782 | |
| 783 | // checkSecuritySettings checks whether recommended security features are enabled. |
| 784 | func checkSecuritySettings(client *api.Client, host, owner, repo string, skillDirs []string) []publishDiagnostic { |
no test coverage detected