Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
d67ed4e0ec |
1 changed files with 18 additions and 9 deletions
|
@ -1,17 +1,26 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
jira_base_url="https://jira.someserver.com"
|
|
||||||
username="userName"
|
# Jira Cloud base URL (replace <your-domain> with your actual domain)
|
||||||
password="password !@#"
|
jira_base_url="https://<your-domain>.atlassian.net"
|
||||||
project_key="projectKey"
|
|
||||||
|
# Update these with your actual Jira Cloud credentials
|
||||||
|
username="email@example.com"
|
||||||
|
api_token="YOUR_API_TOKEN"
|
||||||
|
|
||||||
|
# Replace this with your project key
|
||||||
|
project_key="PROJECTKEY"
|
||||||
|
|
||||||
# 1. Pull a project's component list
|
# 1. Pull a project's component list
|
||||||
|
# Note the 'api/3' in the URL.
|
||||||
raw_data=$(curl -s -X GET \
|
raw_data=$(curl -s -X GET \
|
||||||
-u "$username:$password" \
|
-u "$username:$api_token" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"$jira_base_url/rest/api/2/project/$project_key/components")
|
"$jira_base_url/rest/api/3/project/$project_key/components")
|
||||||
|
|
||||||
# 2. Create a mapping of component ID, component name, and the assignee name
|
# 2. Create a mapping of component ID, component name, and the assignee (lead) info
|
||||||
component_data=$(echo "$raw_data" | jq -c '.[] | {id: .id, name: .name, lead: {name: .lead.name, active: .lead.active}}')
|
# Using jq to parse out the information: .id, .name, .lead.name, and .lead.active
|
||||||
|
component_data=$(echo "$raw_data" | \
|
||||||
|
jq -c '.[] | {id: .id, name: .name, lead: {name: .lead.name, active: .lead.active}}')
|
||||||
|
|
||||||
# 3. Check components for inactive leads
|
# 3. Check components for inactive leads
|
||||||
echo "Components with inactive leads:"
|
echo "Components with inactive leads:"
|
||||||
|
@ -24,4 +33,4 @@ for component in $component_data; do
|
||||||
lead_name=$(echo "$component" | jq -r '.lead.name')
|
lead_name=$(echo "$component" | jq -r '.lead.name')
|
||||||
echo "Component: $component_name, Inactive lead: $lead_name"
|
echo "Component: $component_name, Inactive lead: $lead_name"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue