@@ -125,24 +125,35 @@ jobs:
125125 CHANGED_ARRAY=$(echo "$CHANGED_FILES" | jq -R -s -c 'split("\n") | map(select(length > 0))')
126126 echo "changed_files=$CHANGED_ARRAY" >> $GITHUB_OUTPUT
127127
128- - name : Extract issue number from PR
128+ - name : Extract issue number and metadata from PR
129129 id : get_issue
130130 if : steps.check.outputs.should_run == 'true' && steps.changed_plots.outputs.has_plots == 'true' && steps.get_pr.outputs.pr_number != ''
131131 env :
132132 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
133133 run : |
134- PR_BODY=$(gh pr view ${{ steps.get_pr.outputs.pr_number }} --json body -q '.body')
135- ISSUE_NUM=$(echo "$PR_BODY" | grep -oP '#\K\d+' | head -1 || echo "")
134+ PR_DATA=$(gh pr view ${{ steps.get_pr.outputs.pr_number }} --json body,headRefName)
135+ PR_BODY=$(echo "$PR_DATA" | jq -r '.body')
136+ BRANCH=$(echo "$PR_DATA" | jq -r '.headRefName')
137+
138+ # Extract parent issue from PR body (format: **Parent Issue:** #NUM)
139+ ISSUE_NUM=$(echo "$PR_BODY" | grep -oP '\*\*Parent Issue:\*\* #\K\d+' | head -1 || echo "")
140+
141+ # Extract sub-issue from PR body (format: **Sub-Issue:** #NUM)
142+ SUB_ISSUE_NUM=$(echo "$PR_BODY" | grep -oP '\*\*Sub-Issue:\*\* #\K\d+' | head -1 || echo "")
143+
144+ # Extract library from branch name (format: auto/{spec-id}/{library})
145+ LIBRARY=$(echo "$BRANCH" | cut -d'/' -f3)
136146
137147 if [ -z "$ISSUE_NUM" ]; then
138148 # Try to find issue by branch name
139- BRANCH=$(gh pr view ${{ steps.get_pr.outputs.pr_number }} --json headRefName -q '.headRefName')
140- SPEC_ID=$(echo "$BRANCH" | sed 's/auto\///')
149+ SPEC_ID=$(echo "$BRANCH" | cut -d'/' -f2)
141150 ISSUE_NUM=$(gh issue list --label plot-request --search "$SPEC_ID in:title" --json number -q '.[0].number' || echo "")
142151 fi
143152
144153 echo "issue_num=$ISSUE_NUM" >> $GITHUB_OUTPUT
145- echo "Found issue: #$ISSUE_NUM"
154+ echo "sub_issue_num=$SUB_ISSUE_NUM" >> $GITHUB_OUTPUT
155+ echo "library=$LIBRARY" >> $GITHUB_OUTPUT
156+ echo "Found issue: #$ISSUE_NUM, sub-issue: #$SUB_ISSUE_NUM, library: $LIBRARY"
146157
147158 - name : Setup Google Cloud authentication
148159 if : steps.check.outputs.should_run == 'true' && steps.changed_plots.outputs.has_plots == 'true'
@@ -327,6 +338,8 @@ jobs:
327338 {
328339 "pr_number": ${{ steps.get_pr.outputs.pr_number }},
329340 "issue_number": "${{ steps.get_issue.outputs.issue_num }}",
341+ "sub_issue_number": "${{ steps.get_issue.outputs.sub_issue_num }}",
342+ "library": "${{ steps.get_issue.outputs.library }}",
330343 "bucket": "${GCS_BUCKET}",
331344 "base_path": "plots",
332345 "timestamp": "${TIMESTAMP}",
0 commit comments