Skip to content

Commit 3c0db67

Browse files
authored
Merge pull request #506 from DataIntegrationGroup/jira-automation
Validate Jira base URL before API calls
2 parents 1c3d696 + d5b61a4 commit 3c0db67

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflows/jira_codex_pr.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,27 @@ jobs:
101101
MAX_DESC_CHARS: ${{ env.MAX_DESC_CHARS }}
102102
run: |
103103
set -euo pipefail
104+
for v in JIRA_BASE_URL JIRA_EMAIL JIRA_API_TOKEN JIRA_KEY; do
105+
if [ -z "${!v:-}" ]; then
106+
echo "Missing required Jira configuration: $v"
107+
exit 1
108+
fi
109+
done
110+
111+
case "$JIRA_BASE_URL" in
112+
http://*|https://*) ;;
113+
*)
114+
echo "JIRA_BASE_URL must include scheme and host (e.g., https://your-domain.atlassian.net)"
115+
exit 1
116+
;;
117+
esac
118+
119+
JIRA_BASE_URL="${JIRA_BASE_URL%/}"
120+
ISSUE_URL="$JIRA_BASE_URL/rest/api/3/issue/$JIRA_KEY"
121+
104122
curl -fsS --retry 3 --retry-all-errors -u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
105123
-H "Accept: application/json" \
106-
"$JIRA_BASE_URL/rest/api/3/issue/$JIRA_KEY" > jira.json
124+
"$ISSUE_URL" > jira.json
107125
108126
SUMMARY=$(jq -r '.fields.summary // empty' jira.json)
109127
ISSUE_TYPE=$(jq -r '.fields.issuetype.name // empty' jira.json)
@@ -363,6 +381,23 @@ jobs:
363381
PR_URL: ${{ steps.pr.outputs.PR_URL }}
364382
run: |
365383
set -euo pipefail
384+
for v in JIRA_BASE_URL JIRA_EMAIL JIRA_API_TOKEN JIRA_KEY; do
385+
if [ -z "${!v:-}" ]; then
386+
echo "Missing required Jira configuration: $v"
387+
exit 1
388+
fi
389+
done
390+
391+
case "$JIRA_BASE_URL" in
392+
http://*|https://*) ;;
393+
*)
394+
echo "JIRA_BASE_URL must include scheme and host (e.g., https://your-domain.atlassian.net)"
395+
exit 1
396+
;;
397+
esac
398+
399+
JIRA_BASE_URL="${JIRA_BASE_URL%/}"
400+
366401
if [ -z "$PR_URL" ] || [ "$PR_URL" = "null" ]; then
367402
echo "No PR URL found; skipping Jira comment."
368403
exit 0

0 commit comments

Comments
 (0)