Skip to content

Commit 68c4b36

Browse files
committed
new changes
1 parent 2913aa7 commit 68c4b36

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

examples/codex/jira-github.ipynb

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
"source": [
1111
"# Automate Jira ↔ GitHub with `codex-cli`\n",
1212
"\n",
13-
"## What you'll build\n",
13+
"## Purpose of this cookbook\n",
1414
"\n",
15-
"By the end of this walkthrough, you'll have an end-to-end automation that turns a **labelled Jira issue** into a\n",
16-
"fully-fledged **GitHub pull request**, keeps the Jira ticket updated throughout the review process, and finally merges\n",
17-
"the code once checks pass – all driven by the\n",
18-
"[`codex-cli`](https://github.com/openai/openai-codex) agent working inside a GitHub Action.\n",
15+
"This cookbook provides a practical, step-by-step approach to automating the workflow between Jira and GitHub. By labeling a Jira issue, you trigger an end-to-end process that creates a **GitHub pull request**, keeps both systems updated, and streamlines code review, all with minimal manual effort. The automation is powered by the [`codex-cli`](https://github.com/openai/openai-codex) agent running inside a GitHub Action.\n",
1916
"\n",
2017
"# <img src=\"./images/codex_action.png\" alt=\"Full data-flow diagram\" width=\"500\"/>\n"
2118
]
@@ -29,11 +26,12 @@
2926
},
3027
"source": [
3128
"The flow is:\n",
29+
"\n",
3230
"1. Label a Jira issue \n",
3331
"2. Jira Automation calls the GitHub Action \n",
3432
"3. The action spins up `codex-cli` to implement the change \n",
3533
"4. A PR is opened\n",
36-
"5. Jira is transitioned & annotated creating a neat, zero-click loop\n",
34+
"5. Jira is transitioned & annotated - creating a neat, zero-click loop. This includes changing the status of the ticket, adding the PR link and commenting in the ticket with updates.\n",
3735
"\n",
3836
"## Prerequisites\n",
3937
"\n",
@@ -43,7 +41,7 @@
4341
" * `OPENAI_API_KEY` – your OpenAI key for `codex-cli` \n",
4442
" * `JIRA_BASE_URL`, `JIRA_EMAIL`, `JIRA_API_TOKEN` – for REST calls from the action \n",
4543
"* `codex-cli` installed locally (`pnpm add -g @openai/codex`) for ad-hoc testing \n",
46-
"* A repository that already contains a `.github/workflows/` folder (any Node project is fine)\n"
44+
"* A repository that contains a `.github/workflows/` folder\n"
4745
]
4846
},
4947
{
@@ -58,9 +56,13 @@
5856
"\n",
5957
"<img src=\"./images/jira_rule.png\" alt=\"Automation Rule\" width=\"500\"/>\n",
6058
"\n",
61-
"* **Trigger – Issue updated**: fires whenever labels change \n",
62-
"* **Condition – `labels` contains `autocodex`**: limits noise to explicitly opted-in issues \n",
63-
"* **Action – Send web request**: POSTs the issue key/summary/description to your GitHub Action's `workflow_dispatch` endpoint\n"
59+
"The first step in this rule listens for changes to an issue’s labels. This ensures we only trigger the automation when a label is added or modified—no need to process every update to the issue.\n",
60+
"\n",
61+
"Next, we check whether the updated labels include a specific keyword, in our example we are using `aswe`. This acts as a filter so that only issues explicitly tagged for automation proceed, avoiding unnecessary noise from unrelated updates.\n",
62+
"\n",
63+
"If the condition is met, we send a `POST` request to GitHub’s `workflow_dispatch` endpoint. This kicks off a GitHub Actions workflow with the relevant issue context. We pass in the issue key, summary, and a cleaned-up version of the description—escaping quotes and newlines so the payload parses correctly in YAML/JSON. There are [additional fields](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/) available as variables in JIRA to give the codex agent more context during its execution.\n",
64+
"\n",
65+
"This setup allows teams to tightly control which Jira issues trigger automation, and ensures GitHub receives structured, clean metadata to act on. We can also set up multiple labels, each triggering a different GitHub Action. For example, one label could kick off a quick bug fix workflow, while another might start work on refactoring code or generating API stubs.\n"
6466
]
6567
},
6668
{
@@ -73,7 +75,9 @@
7375
"source": [
7476
"## Add the GitHub Action\n",
7577
"\n",
76-
"Create a workflow file in your `.github/workflows/` directory with the following YAML (Modify it as needed):\n"
78+
"GitHub Actions enable you to automate workflows within your GitHub repository by defining them in YAML files. These workflows specify a series of jobs and steps to execute. When triggered either manually or via a POST request, GitHub automatically provisions the necessary environment and runs the defined workflow steps.\n",
79+
"\n",
80+
"To process the `POST` request from JIRA we will create a Github action with a YAML like below in the `.github/workflows/` directory of the repository:\n"
7781
]
7882
},
7983
{
@@ -138,6 +142,7 @@
138142
" --user \"$JIRA_EMAIL:$JIRA_API_TOKEN\" \\\n",
139143
" --header 'Content-Type: application/json' \\\n",
140144
" --data '{\"transition\":{\"id\":\"21\"}}'\n",
145+
" # 21 is the transition ID for changing the ticket status to In Progress. Learn more here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get\n",
141146
"\n",
142147
" # 4 – Set Git author for CI commits\n",
143148
" - run: |\n",
@@ -185,6 +190,7 @@
185190
" --user \"$JIRA_EMAIL:$JIRA_API_TOKEN\" \\\n",
186191
" --header 'Content-Type: application/json' \\\n",
187192
" --data '{\"transition\":{\"id\":\"31\"}}'\n",
193+
" # 31 is the Transition ID for changing the ticket status to In Review. Learn more here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get\n",
188194
"\n",
189195
" # Comment with PR link\n",
190196
" curl -sS -X POST \\\n",
@@ -232,10 +238,10 @@
232238
"source": [
233239
"## Label an Issue\n",
234240
"\n",
235-
"Attach the special `autocodex` label to any bug/feature ticket:\n",
241+
"Attach the special `aswe` label to any bug/feature ticket:\n",
236242
"\n",
237243
"1. **During creation** – add it in the \"Labels\" field before hitting *Create* \n",
238-
"2. **Existing issue** – hover the label area → click the pencil icon → type `autocodex`\n",
244+
"2. **Existing issue** – hover the label area → click the pencil icon → type `aswe`\n",
239245
"\n",
240246
"<img src=\"./images/add_label.png\" alt=\"Adding a label\" width=\"500\"/>\n"
241247
]
@@ -248,7 +254,7 @@
248254
}
249255
},
250256
"source": [
251-
"## End-to-end Flow in Action\n",
257+
"## End-to-end Flow\n",
252258
"\n",
253259
"1. Jira label added → Automation triggers\n",
254260
"2. `workflow_dispatch` fires; action spins up on GitHub\n",
@@ -271,9 +277,7 @@
271277
"source": [
272278
"## Review & Merge the PR\n",
273279
"\n",
274-
"* Confirm CI passes – tests, lint, build\n",
275-
"* Approve & squash-merge\n",
276-
"* The default branch protection will auto-close the Jira ticket once the PR merges if your *Smart Commits* integration is enabled\n",
280+
"You can open the PR link posted in the JIRA ticket and check to see if everything looks good and then merge it. If you have branch protection and Smart Commits integration enabled, the Jira ticket will be automatically closed when the pull request is merged.\n",
277281
"\n",
278282
"## Conclusion\n",
279283
"\n",
@@ -284,10 +288,13 @@
284288
"* **Improved developer experience** - Focus on reviewing quality code instead of writing boilerplate\n",
285289
"* **Reduced handoff friction** - The PR is ready for review as soon as the ticket is labeled\n",
286290
"\n",
287-
"The `codex-cli` tool is a powerful AI coding assistant that automates repetitive programming tasks. You can explore more about it at:\n",
288-
"\n",
289-
"* [OpenAI Codex-CLI GitHub Repository](https://github.com/openai/codex/)"
291+
"The `codex-cli` tool is a powerful AI coding assistant that automates repetitive programming tasks. You can explore more about it [here](https://github.com/openai/codex/)"
290292
]
293+
},
294+
{
295+
"cell_type": "markdown",
296+
"metadata": {},
297+
"source": []
291298
}
292299
],
293300
"metadata": {

0 commit comments

Comments
 (0)