Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

fix: dynamic testers list #42

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions actions/promote.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import (
"encoding/base64"
"fmt"
"io/ioutil"

Check failure on line 6 in actions/promote.go

View workflow job for this annotation

GitHub Actions / go-check / All

"io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (SA1019)
"net/http"
"regexp"
"strings"

"github.com/ipfs/kuboreleaser/github"
Expand Down Expand Up @@ -32,22 +35,41 @@
- Release Notes: https://github.com/ipfs/kubo/blob/release-%s/docs/changelogs/%s.md`, ctx.Version, ctx.Version, ctx.Version, ctx.Version, ctx.Version.MajorMinorPatch(), ctx.Version.MajorMinor())
}

func fetchEarlyTestersList() string {
url := "https://raw.githubusercontent.com/ipfs/kubo/master/docs/EARLY_TESTERS.md"
resp, err := http.Get(url)
if err != nil {
log.Warn("Error fetching EARLY_TESTERS.md:", err)
return ""

Check warning on line 43 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L38-L43

Added lines #L38 - L43 were not covered by tests
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Warn("Error reading EARLY_TESTERS.md:", err)
return ""

Check warning on line 49 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L45-L49

Added lines #L45 - L49 were not covered by tests
}
content := string(body)

Check warning on line 51 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L51

Added line #L51 was not covered by tests

// Find the "Who has signed up?" section
re := regexp.MustCompile(`(?s)## Who has signed up\?(.+?)(?:$|##)`)
matches := re.FindStringSubmatch(content)
if len(matches) < 2 {
log.Warn("'Who has signed up' Section not found in EARLY_TESTERS.md")
return ""

Check warning on line 58 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L54-L58

Added lines #L54 - L58 were not covered by tests
}
testers := strings.TrimSpace(matches[1])

Check warning on line 60 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L60

Added line #L60 was not covered by tests

return testers

Check warning on line 62 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L62

Added line #L62 was not covered by tests
}

func (ctx *Promote) getReleaseIssueComment() string {
if ctx.Version.IsPrerelease() {
return fmt.Sprintf(`Early testers ping for %s testing 😄.

- [ ] Charity Engine (@rytiss, @tristanolive)
- [ ] Fission (@bmann)
- [ ] Infura (@MichaelMure)
- [ ] OrbitDB (@aphelionz)
- [ ] pacman.store (@RubenKelevra)
- [ ] Pinata (@obo20)
- [ ] PL EngRes bifrost (@gmasgras)
- [ ] RTrade (@postables)
- [ ] Siderus (@koalalorenzo)
- [ ] Textile (@sanderpick)

You're getting this message because you're listed [here](https://github.com/ipfs/kubo/blob/master/docs/EARLY_TESTERS.md#who-has-signed-up). Please update this list if you no longer want to be included.`, ctx.Version)
testers := fetchEarlyTestersList()
if ctx.Version.IsPrerelease() && testers != "" {
return fmt.Sprintf(`Early testers ping for %s testing ✨

Check warning on line 68 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L66-L68

Added lines #L66 - L68 were not covered by tests

%s

Check warning on line 70 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L70

Added line #L70 was not covered by tests

You're getting this message because you're listed [here](https://github.com/ipfs/kubo/blob/master/docs/EARLY_TESTERS.md#who-has-signed-up). Please update this list if you no longer want to be included.`, ctx.Version, testers)

Check warning on line 72 in actions/promote.go

View check run for this annotation

Codecov / codecov/patch

actions/promote.go#L72

Added line #L72 was not covered by tests
} else {
return fmt.Sprintf("🎉 Kubo [%s](https://github.com/ipfs/kubo/releases/tag/%s) is out!", ctx.Version, ctx.Version)
}
Expand Down
Loading