atlassianapi について
JiraとConfluenceを利用する開発者やエージェントのワークフロー向けのAtlassian APIスキルです。REST API操作、Webhook、プルリクエストの同期やリリースノート公開などの自動化例を扱います。
主な機能
- 01Jira課題とスプリントの操作
- 02Confluenceページの管理と検索
- 03Webhookの登録と処理
- 04JiraとConfluenceの自動化例
活用シーン
- 01Jira課題の検索と更新
- 02リリースノートのConfluence公開
- 03プルリクエストとJiraの同期
- 04Jira課題Webhookの処理
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ thelobbi/ claude --skill atlassianapiインストール後、Claude Code で/atlassianapiを入力して読み込まれたか確認します。
詳細
Atlassian API スキル
Golden Armada AI Agent Fleet Platform 向けに、包括的な Atlassian API 統合機能を提供します。
このスキルを使用するタイミング
次の作業を行う際に、このスキルを有効にします。
- Jira REST API の統合
- Confluence REST API の統合
- Atlassian Webhook
- 自動化とスクリプト作成
- クロスプラットフォームの同期
認証
API トークン(Cloud)
```python import requests from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('[email protected]', 'API_TOKEN') headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' }
base_url = 'https://your-domain.atlassian.net' ```
Python クライアントライブラリ
```python from atlassian import Jira, Confluence
jira = Jira( url='https://your-domain.atlassian.net', username='[email protected]', password='API_TOKEN', cloud=True )
confluence = Confluence( url='https://your-domain.atlassian.net', username='[email protected]', password='API_TOKEN', cloud=True ) ```
Jira REST API
課題
```python
課題を作成
response = requests.post( f'{base_url}/rest/api/3/issue', auth=auth, headers=headers, json={ 'fields': { 'project': {'key': 'GA'}, 'summary': 'Implement agent monitoring', 'description': { 'type': 'doc', 'version': 1, 'content': [ { 'type': 'paragraph', 'content': [ {'type': 'text', 'text': 'Description text'} ] } ] }, 'issuetype': {'name': 'Story'}, 'priority': {'name': 'High'}, 'labels': ['backend', 'monitoring'] } } )
課題を取得
response = requests.get( f'{base_url}/rest/api/3/issue/GA-123', auth=auth, headers=headers ) issue = response.json()
課題を更新
response = requests.put( f'{base_url}/rest/api/3/issue/GA-123', auth=auth, headers=headers, json={ 'fields': { 'summary': 'Updated summary' } } )
課題をトランジション
まず、利用可能なトランジションを取得
transitions = requests.get( f'{base_url}/rest/api/3/issue/GA-123/transitions', auth=auth, headers=headers ).json()
次にトランジションを実行
requests.post( f'{base_url}/rest/api/3/issue/GA-123/transitions', auth=auth, headers=headers, json={'transition': {'id': '31'}} # 利用可能なトランジションの ID )
コメントを追加
requests.post( f'{base_url}/rest/api/3/issue/GA-123/comment', auth=auth, headers=headers, json={ 'body': { 'type': 'doc', 'version': 1, 'content': [ { 'type': 'paragraph', 'content': [ {'type': 'text', 'text': 'Comment text'} ] } ] } } ) ```
JQL 検索
```python
課題を検索
jql = 'project = GA AND status = "In Progress" ORDER BY created DESC' response = requests.get( f'{base_url}/rest/api/3/search', auth=auth, headers=headers, params={ 'jql': jql, 'maxResults': 50, 'fields': 'summary,status,assignee,priority' } ) results = response.json()
for issue in results['issues']: print(f"{issue['key']}: {issue['fields']['summary']}") ```
スプリントとボード
```python
ボードを取得
boards = requests.get( f'{base_url}/rest/agile/1.0/board', auth=auth, headers=headers ).json()
ボードのスプリントを取得
board_id = 1 sprints = requests.get( f'{base_url}/rest/agile/1.0/board/{board_id}/sprint', auth=auth, headers=headers ).json()
スプリント内の課題を取得
sprint_id = 10 issues = requests.get( f'{base_url}/rest/agile/1.0/sprint/{sprint_id}/issue', auth=auth, headers=headers ).json()
課題をスプリントに移動
requests.post( f'{base_url}/rest/agile/1.0/sprint/{sprint_id}/issue', auth=auth, headers=headers, json={'issues': ['GA-123', 'GA-124']} ) ```
Confluence REST API
ページ
```python
ページを作成
response = requests.post( f'{base_url}/wiki/rest/api/content', auth=auth, headers=headers, json={ 'type': 'page', 'title': 'Agent Architecture', 'space': {'key': 'GA'}, 'body': { 'storage': { 'value': '
Overview
Content here...
', 'representation': 'storage' } } } )ページを取得
page = requests.get( f'{base_url}/wiki/rest/api/content/12345', auth=auth, headers=headers, params={'expand': 'body.storage,version'} ).json()
ページを更新
requests.put( f'{base_url}/wiki/rest/api/content/12345', auth=auth, headers=headers, json={ 'type': 'page', 'title': 'Updated Title', 'body': { 'storage': { 'value': '
Updated Content
', 'representation': 'storage' } }, 'version': {'number': page['version']['number'] + 1} } )ページを検索
results = requests.get( f'{base_url}/wiki/rest/api/content/search', auth=auth, headers=headers, params={'cql': 'space = GA AND text ~ "agent"'} ).json() ```
Webhooks
Jira Webhook ハンドラー
```python from flask import Flask, request
app = Flask(name)
@app.route('/webhooks/jira', methods=['POST']) def handle_jira_webhook(): event = request.json event_type = event.get('webhookEvent')
if event_type == 'jira:issue_created':
issue = event['issue']
handle_issue_created(issue)
elif event_type == 'jira:issue_updated':
issue = event['issue']
changelog = event.get('changelog', {})
handle_issue_updated(issue, changelog)
elif event_type == 'sprint_started':
sprint = event['sprint']
handle_sprint_started(sprint)
return {'status': 'ok'}
def handle_issue_created(issue): print(f"Issue created: {issue['key']}")
def handle_issue_updated(issue, changelog): for item in changelog.get('items', []): if item['field'] == 'status': print(f"Issue {issue['key']} status changed: {item['fromString']} -> {item['toString']}") ```
Webhook を登録
```python
Jira webhook を登録
webhook = requests.post( f'{base_url}/rest/webhooks/1.0/webhook', auth=auth, headers=headers, json={ 'name': 'Golden Armada Integration', 'url': 'https://your-app.com/webhooks/jira', 'events': [ 'jira:issue_created', 'jira:issue_updated', 'sprint_started', 'sprint_closed' ], 'filters': { 'issue-related-events-section': 'project = GA' } } ) ```
自動化レシピ
GitHub PR を Jira に同期
```python async def sync_pr_to_jira(pr_data: dict): # ブランチ名から Jira 課題キーを抽出(例:feature/GA-123-add-feature) branch = pr_data['head']['ref'] match = re.search(r'(GA-\d+)', branch) if not match: return
issue_key = match.group(1)
# PR リンクを含むコメントを追加
jira.add_comment(
issue_key,
f"PR opened: [{pr_data['title']}]({pr_data['html_url']})"
)
# PR の準備ができていれば「レビュー中」に移行
if not pr_data.get('draft'):
jira.transition_issue(issue_key, 'In Review')
```
Auto-create Release Notes
```python def generate_release_notes(version: str, project_key: str = 'GA'): # Get all issues in the release jql = f'project = {project_key} AND fixVersion = "{version}" ORDER BY issuetype' issues = jira.jql(jql)['issues']
# Group by type
features = [i for i in issues if i['fields']['issuetype']['name'] == 'Story']
bugs = [i for i in issues if i['fields']['issuetype']['name'] == 'Bug']
# Generate markdown
notes = f"# Release {version}\n\n"
notes += "## Features\n"
for issue in features:
notes += f"- [{issue['key']}] {issue['fields']['summary']}\n"
notes += "\n## Bug Fixes\n"
for issue in bugs:
notes += f"- [{issue['key']}] {issue['fields']['summary']}\n"
# Create Confluence page
confluence.create_page(
space='GA',
title=f'Release Notes - {version}',
body=markdown_to_confluence(notes),
parent_id=RELEASE_NOTES_PARENT_ID
)
```
Golden Armada Commands
```bash
Sync with Atlassian
/atlassian-sync --jira --confluence
Create Jira issue from template
/jira-create --type story --template agent-feature
Update Confluence docs from code
/confluence-publish --from docs/ --space GA ```