Update file getInactiveComponentLead.sh
This commit is contained in:
commit
0b52ce402d
1 changed files with 27 additions and 0 deletions
27
getInactiveComponentLead.sh
Normal file
27
getInactiveComponentLead.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
jira_base_url="https://jira.someserver.com"
|
||||
username="userName"
|
||||
password="password !@#"
|
||||
project_key="projectKey"
|
||||
|
||||
# 1. Pull a project's component list
|
||||
raw_data=$(curl -s -X GET \
|
||||
-u "$username:$password" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$jira_base_url/rest/api/2/project/$project_key/components")
|
||||
|
||||
# 2. Create a mapping of component ID, component name, and the assignee name
|
||||
component_data=$(echo "$raw_data" | jq -c '.[] | {id: .id, name: .name, lead: {name: .lead.name, active: .lead.active}}')
|
||||
|
||||
# 3. Check components for inactive leads
|
||||
echo "Components with inactive leads:"
|
||||
IFS=$'\n'
|
||||
for component in $component_data; do
|
||||
lead_active=$(echo "$component" | jq -r '.lead.active')
|
||||
|
||||
if [ "$lead_active" = "false" ]; then
|
||||
component_name=$(echo "$component" | jq -r '.name')
|
||||
lead_name=$(echo "$component" | jq -r '.lead.name')
|
||||
echo "Component: $component_name, Inactive lead: $lead_name"
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue