Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created August 6, 2021 12:57
Show Gist options
  • Save percybolmer/eb2277660e70cc83e32df4d8d01d5401 to your computer and use it in GitHub Desktop.
Save percybolmer/eb2277660e70cc83e32df4d8d01d5401 to your computer and use it in GitHub Desktop.
func main() {
// Load the .env file
godotenv.Load(".env")
// Create a BasicAuth Transport object
tp := jira.BasicAuthTransport{
Username: os.Getenv("JIRA_USER"),
Password: os.Getenv("JIRA_TOKEN"),
}
// Create a new Jira Client
client, err := jira.NewClient(tp.Client(), os.Getenv("JIRA_URL"))
if err != nil {
log.Fatal(err)
}
//getProjects(client)
issues, err := getIssues(client, "project = 'YourProject' and Status = 'ON HOLD'")
if err != nil {
log.Fatal(err)
}
for _, issue := range issues {
if issue.Key == "MyIssueKey" {
transition, err := getIssueTransition(client, issue, "In Progress")
if err != nil {
log.Fatal(err)
}
// Perform transition
err = transitionIssue(client, issue, transition)
if err != nil {
log.Fatal(err)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment