Last active
February 26, 2026 13:13
-
-
Save hushin/69ce01d8ba4dae9b7ab22f40968a37c2 to your computer and use it in GitHub Desktop.
Jiraのタスクを大量に作るscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async () => { | |
| const rawData = sessionStorage.getItem('awc.last.screen.event'); | |
| if (!rawData) return console.error('Data not found'); | |
| const { attributes: jiraData } = JSON.parse(rawData); | |
| const tasks = ` | |
| foo | |
| bar | |
| `.trim().split('\n').map(t => `hoge: ${t}`); | |
| const createSubtask = async (summary) => { | |
| const body = { | |
| fields: { | |
| project: { id: jiraData.projectId }, | |
| issuetype: { id: '10231' }, // task: 10231, subtask: 10798 | |
| summary: summary.trim(), | |
| description: `h1. 概要 | |
| piyopiyo | |
| `, | |
| parent: { id: jiraData.issueId }, | |
| }, | |
| }; | |
| const res = await fetch('/rest/api/2/issue', { | |
| method: 'POST', | |
| headers: { | |
| 'accept': 'application/json,text/javascript,*/*', | |
| 'content-type': 'application/json', | |
| 'x-atlassian-capability': 'ISSUE_VIEW--other', | |
| }, | |
| body: JSON.stringify(body), | |
| }); | |
| return res.json(); | |
| }; | |
| const results = await Array.fromAsync(tasks, createSubtask); | |
| console.log('Results:', results); | |
| console.log('Subtask created'); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment