1+ #! /usr/bin/env bash
2+ #
3+ # Quick setup for bugwarrior 1Password items
4+ #
5+
6+ set -euo pipefail
7+
8+ echo " 🔐 Setting up 1Password items for bugwarrior..."
9+ echo " "
10+ echo " This will help you create the required 1Password items."
11+ echo " You'll need:"
12+ echo " 1. Your Jira email and API token"
13+ echo " 2. Your GitHub username and personal access token(s)"
14+ echo " "
15+
16+ # Function to test 1Password item
17+ test_item () {
18+ local item_name=" $1 "
19+ if op item get " $item_name " --fields label=username & > /dev/null; then
20+ echo " ✅ Found: $item_name "
21+ return 0
22+ else
23+ echo " ❌ Missing: $item_name "
24+ return 1
25+ fi
26+ }
27+
28+ # Check existing items
29+ echo " Checking existing 1Password items..."
30+ echo " "
31+
32+ items_needed=()
33+ test_item " Seqera Jira" || items_needed+=(" jira" )
34+ test_item " GitHub Token" || items_needed+=(" github-work" )
35+ test_item " GitHub Personal Token" || items_needed+=(" github-personal" )
36+
37+ if [ ${# items_needed[@]} -eq 0 ]; then
38+ echo " "
39+ echo " ✅ All required 1Password items found!"
40+ exit 0
41+ fi
42+
43+ echo " "
44+ echo " Let's create the missing items..."
45+ echo " "
46+
47+ # Create Jira item if needed
48+ if [[ " ${items_needed[@]} " =~ " jira " ]]; then
49+ echo " 📋 Seqera Jira Setup"
50+ echo " Get your API token from: https://seqera.atlassian.net/secure/ViewProfile.jspa"
51+ echo " Go to 'Personal Access Tokens' and create one"
52+ echo " "
53+ read -p " Jira email: " jira_user
54+ read -s -p " Jira API token: " jira_token
55+ echo " "
56+
57+ op item create \
58+ --category=login \
59+ --title=" Seqera Jira" \
60+ username=" $jira_user " \
61+ password=" $jira_token " \
62+ --vault=Private || echo " Failed to create Jira item"
63+ fi
64+
65+ # Create GitHub work token if needed
66+ if [[ " ${items_needed[@]} " =~ " github-work " ]]; then
67+ echo " "
68+ echo " 🐙 GitHub Token Setup (for Seqera repos)"
69+ echo " Create token at: https://github.com/settings/tokens"
70+ echo " Required scopes: repo (full control)"
71+ echo " "
72+ read -p " GitHub username: " github_user
73+ read -s -p " GitHub personal access token: " github_token
74+ echo " "
75+
76+ op item create \
77+ --category=login \
78+ --title=" GitHub Token" \
79+ username=" $github_user " \
80+ password=" $github_token " \
81+ --vault=Private || echo " Failed to create GitHub Token item"
82+ fi
83+
84+ # Create GitHub personal token if needed
85+ if [[ " ${items_needed[@]} " =~ " github-personal " ]]; then
86+ echo " "
87+ echo " 🐙 GitHub Personal Token Setup (for personal repos)"
88+ echo " You can use the same token as above or create a separate one"
89+ echo " "
90+ read -p " Use same token as work? (y/n): " use_same
91+
92+ if [[ " $use_same " == " y" ]]; then
93+ op item create \
94+ --category=login \
95+ --title=" GitHub Personal Token" \
96+ username=" $github_user " \
97+ password=" $github_token " \
98+ --vault=Private || echo " Failed to create GitHub Personal Token item"
99+ else
100+ read -p " GitHub username: " github_personal_user
101+ read -s -p " GitHub personal access token: " github_personal_token
102+ echo " "
103+
104+ op item create \
105+ --category=login \
106+ --title=" GitHub Personal Token" \
107+ username=" $github_personal_user " \
108+ password=" $github_personal_token " \
109+ --vault=Private || echo " Failed to create GitHub Personal Token item"
110+ fi
111+ fi
112+
113+ echo " "
114+ echo " 🎉 Setup complete!"
115+ echo " "
116+ echo " Next steps:"
117+ echo " 1. Test with: bugwarrior-pull --dry-run"
118+ echo " 2. Run full sync: bugwarrior-pull"
0 commit comments