{"action":"closed","issue":{"url":"https://api.github.com/repos/google/go-github/issues/445","repository_url":"https://api.github.com/repos/google/go-github","labels_url":"https://api.github.com/repos/google/go-github/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/google/go-github/issues/445/comments","events_url":"https://api.github.com/repos/google/go-github/issues/445/events","html_url":"https://github.com/google/go-github/issues/445","id":181614351,"number":445,"title":"How list repositories tags for organization ?","user":{"login":"nlamirault","id":29233,"avatar_url":"https://avatars.githubusercontent.com/u/29233?v=3","gravatar_id":"","url":"https://api.github.com/users/nlamirault","html_url":"https://github.com/nlamirault","followers_url":"https://api.github.com/users/nlamirault/followers","following_url":"https://api.github.com/users/nlamirault/following{/other_user}","gists_url":"https://api.github.com/users/nlamirault/gists{/gist_id}","starred_url":"https://api.github.com/users/nlamirault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlamirault/subscriptions","organizations_url":"https://api.github.com/users/nlamirault/orgs","repos_url":"https://api.github.com/users/nlamirault/repos","events_url":"https://api.github.com/users/nlamirault/events{/privacy}","received_events_url":"https://api.github.com/users/nlamirault/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-07T08:44:24Z","updated_at":"2016-10-09T16:48:40Z","closed_at":"2016-10-09T16:48:40Z","body":"Hi,\r\ni try to list releases for repositories from an Organization.\r\nThe code : \r\n\r\n```go\r\nfunc getReleases() string {\r\n\tvar buffer bytes.Buffer\r\n\tbuffer.WriteString(\"Releases:\\n\")\r\n\r\n\tclient := github.NewClient(nil)\r\n\r\n\t// list public repositories for org \"github\"\r\n\topt := &github.RepositoryListByOrgOptions{Type: \"public\"}\r\n\trepos, _, _ := client.Repositories.ListByOrg(\"Zeiot\", opt)\r\n\tfor _, repo := range repos {\r\n\t\tfmt.Printf(\"[DEBUG] Repo %s: %s\\n\", *repo.Owner.Login, *repo.ReleasesURL)\r\n\t}\r\n\r\n\tfor _, project := range []string{\"jarvis\", \"rpi-prometheus\", \"rpi-nats\", \"rpi-speedtest_exporter\", \"rpi-grafana\"} {\r\n\t\trelease, err := getGithubRelease(client, project)\r\n\t\tif err != nil {\r\n\t\t\tlog.Printf(\"[WARN] Project: %s\", err)\r\n\t\t} else {\r\n\t\t\tbuffer.WriteString(fmt.Sprintf(\"%s: %s\\n\", project, *release))\r\n\t\t}\r\n\t}\r\n\ttext := buffer.String()\r\n\tlog.Printf(\"[INFO] Github releases: %s\", text)\r\n\treturn text\r\n}\r\n\r\nfunc getGithubRelease(client *github.Client, project string) (*string, error) {\r\n\tlog.Printf(\"[DEBUG] Get last release from Github: %s\", project)\r\n\tlatestRelease, _, err := client.Repositories.GetLatestRelease(\"zeiot\", project)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn latestRelease.TagName, nil\r\n}\r\n```\r\n\r\nAnd the output : \r\n\r\n```bash\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/arduino-examples/releases{/id}\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/jarvis/releases{/id}\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/rpi-grafana/releases{/id}\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/rpi-prometheus/releases{/id}\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/rpi-mosquitto/releases{/id}\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/rpi-nats/releases{/id}\r\n[DEBUG] Repo zeiot: https://api.github.com/repos/zeiot/rpi-speedtest_exporter/releases{/id}\r\n2016/10/07 10:43:44 [DEBUG] Get last release from Github: jarvis\r\n2016/10/07 10:43:45 [WARN] Project: GET https://api.github.com/repos/zeiot/jarvis/releases/latest: 404 Not Found []\r\n2016/10/07 10:43:45 [DEBUG] Get last release from Github: rpi-prometheus\r\n2016/10/07 10:43:45 [WARN] Project: GET https://api.github.com/repos/zeiot/rpi-prometheus/releases/latest: 404 Not Found []\r\n2016/10/07 10:43:45 [DEBUG] Get last release from Github: rpi-nats\r\n2016/10/07 10:43:45 [WARN] Project: GET https://api.github.com/repos/zeiot/rpi-nats/releases/latest: 404 Not Found []\r\n2016/10/07 10:43:45 [DEBUG] Get last release from Github: rpi-speedtest_exporter\r\n2016/10/07 10:43:45 [WARN] Project: GET https://api.github.com/repos/zeiot/rpi-speedtest_exporter/releases/latest: 404 Not Found []\r\n2016/10/07 10:43:45 [DEBUG] Get last release from Github: rpi-grafana\r\n2016/10/07 10:43:45 [WARN] Project: GET https://api.github.com/repos/zeiot/rpi-grafana/releases/latest: 404 Not Found []\r\n2016/10/07 10:43:45 [INFO] Github releases: Releases:\r\n```\r\n\r\nAny idead ? Thanks."}}
{"actor":{"display_login":"gmlewis"}}