File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -54,18 +54,28 @@ runs:
54
54
return ""
55
55
}
56
56
return ',"customfield_10001" : "' + teamId + '"'
57
-
58
57
- name : Fetch CUSTOM_FIELDS if defined
59
58
id : fetch_custom_fields_if_defined
60
59
uses : actions/github-script@v6
61
60
with :
62
61
result-encoding : string
63
62
script : |
64
- const customFields = "${{ inputs.CUSTOM_FIELDS }}"
65
- if (customFields) {
66
- return ',' + customFields
63
+ const rawCustomFields = `${{ inputs.CUSTOM_FIELDS }}`.trim();
64
+ if (rawCustomFields) {
65
+ try {
66
+ const inputToParse = rawCustomFields.startsWith('{') ? rawCustomFields : `{${rawCustomFields}}`;
67
+ const parsedCustomFields = JSON.parse(inputToParse);
68
+ console.log(`Parsed CUSTOM_FIELDS: ${JSON.stringify(parsedCustomFields)}`);
69
+ return ',' + Object.entries(parsedCustomFields)
70
+ .map(([key, value]) => `"${key}": "${value}"`)
71
+ .join(', ');
72
+ } catch (error) {
73
+ throw new Error(
74
+ `Invalid CUSTOM_FIELDS format: '${rawCustomFields}'. Must be either a valid JSON object or key-value pairs in JSON format.`
75
+ );
76
+ }
67
77
}
68
- return ""
78
+ return '';
69
79
- name : Create Jira issue
70
80
id : create_jira_issue
71
81
uses : atlassian/gajira-create@v2.0.1
You can’t perform that action at this time.
0 commit comments