Commit f2b13fda authored by Manuel Vogel's avatar Manuel Vogel 💬

fix: getting files

parent 63aacfc3
Pipeline #74241645 passed with stage
in 2 minutes and 59 seconds
......@@ -25,12 +25,12 @@ func main() {
client := gitlab.NewClient(nil, token)
gitlabBaseURL := "https://gitlab.com"
releaseProjectPID := "mavogel/release-testing" // 12642869
// releaseProjectPID := "mavogel/release-testing" // 12642869
// file := "test_upload3.txt"
// DONE :)))
// testingReleases(client, gitlabBaseURL, releaseProjectPID, file)
creatingFiles(client, gitlabBaseURL, releaseProjectPID)
creatingFiles(client, gitlabBaseURL)
}
func testingReleases(client *gitlab.Client, gitlabBaseURL, releaseProjectPID, file string) {
......@@ -100,8 +100,9 @@ func testingReleases(client *gitlab.Client, gitlabBaseURL, releaseProjectPID, fi
}
}
func creatingFiles(client *gitlab.Client, gitlabBaseURL, releaseProjectPID string) {
existingFile := "release-testing_0.3.7_Darwin_x86_64.tar.gz"
func creatingFiles(client *gitlab.Client, gitlabBaseURL string) {
brewTapProjectPID := "mavogel/homebrew-tab"
existingFile := "Formula/release-testing-program.rb"
// nonExistingFile := "i-do-not-exist"
fileName := existingFile
......@@ -109,9 +110,9 @@ func creatingFiles(client *gitlab.Client, gitlabBaseURL, releaseProjectPID strin
opts := &gitlab.GetFileOptions{
Ref: &ref,
}
//https://gitlab.com/mavogel/release-testing/uploads/22e8b1508b0f28433b94754a5ea2f4aa/release-testing_0.3.7_Darwin_x86_64.tar.gz
// client.ReleaseLinks.GetReleaseLink()
file, res, err := client.RepositoryFiles.GetFile(releaseProjectPID, fileName, opts)
file, res, err := client.RepositoryFiles.GetFile(brewTapProjectPID, fileName, opts)
fmt.Printf("res.StatusCode: %v\n", res.StatusCode)
if err != nil && res.StatusCode != 404 {
fmt.Printf("res: %v", res)
panic(err)
......@@ -123,14 +124,4 @@ func creatingFiles(client *gitlab.Client, gitlabBaseURL, releaseProjectPID strin
fmt.Printf("res: %#v\n", res)
fmt.Printf("file: %#v\n", file)
}
name := "0.3.7"
tagName := name
release, res, err := client.Releases.GetRelease(releaseProjectPID, tagName)
for _, link := range release.Assets.Links {
fmt.Printf("link: %v", link)
}
// ref := "fe1b3be8fa83a486decc5b81a054dd9ab3d289fe" // Devskim ignore: DS173237
// link := 4649 // from create link
// client.ReleaseLinks.GetReleaseLink(releaseProjectPID, tagName, link)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment