Skip to content

Commit

Permalink
Add annotation for specs repo users (#103)
Browse files Browse the repository at this point in the history
* Add annotation for specs repo users

* Make it pop
  • Loading branch information
ofalvai authored Apr 16, 2024
1 parent b00e2e2 commit 6506fe8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ func main() {
if err != nil {
log.Warnf("Failed to determine if Podfile is using Specs repo, error: %s", err)
} else {
if isUsingSpecsRepo {
addSpecsRepoAnnotation(cmdFactory)
}
tracker.Enqueue("step_cocoapods_install_podfile_used", analytics.Properties{
"step_execution_id": envRepository.Get("BITRISE_STEP_EXECUTION_ID"),
"build_slug": envRepository.Get("BITRISE_BUILD_SLUG"),
Expand Down
13 changes: 13 additions & 0 deletions podfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ import (
"bufio"
"os"
"strings"

"github.com/bitrise-io/go-utils/v2/command"
)

const specsRepoWarning = `### CocoaPods tip
Your Podfile is still using the Specs repo. Switch to the CDN source for **faster and more reliable** dependency installs!
Learn more about the **one-line change** [here](https://blog.cocoapods.org/CocoaPods-1.8.0-beta/).
`

// isPodfileUsingSpecsRepo returns true if the Podfile contains a source 'https://github.com/CocoaPods/Specs.git'.
// It returns false if the CDN source or any other 3rd party git source is used.
func isPodfileUsingSpecsRepo(path string) (bool, error) {
Expand Down Expand Up @@ -33,3 +41,8 @@ func isPodfileUsingSpecsRepo(path string) (bool, error) {

return specsRepoDefined, nil
}

func addSpecsRepoAnnotation(cmdFactory command.Factory) {
cmd := cmdFactory.Create("bitrise", []string{":annotations", "annotate", specsRepoWarning, "--style", "info"}, nil)
_ = cmd.Run() // ignore error, this is best-effort
}

0 comments on commit 6506fe8

Please sign in to comment.