Skip to content

Commit 1818939

Browse files
Fix: Issue-ID handling for ONAP, etc
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
1 parent ee0a333 commit 1818939

3 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/workflows/github2gerrit.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ on:
9595
required: false
9696
default: ""
9797
type: string
98+
ISSUE_ID_LOOKUP:
99+
description: "Enable Issue ID lookup via JSON table"
100+
required: false
101+
default: false
102+
type: boolean
103+
ISSUE_ID_LOOKUP_JSON:
104+
description: "JSON array mapping GitHub actors to Issue IDs"
105+
required: false
106+
default: "[]"
107+
type: string
98108
ALLOW_DUPLICATES:
99109
description: "Allow submitting duplicate changes without error"
100110
required: false
@@ -184,6 +194,8 @@ jobs:
184194
PRESERVE_GITHUB_PRS: ${{ inputs.PRESERVE_GITHUB_PRS }}
185195
DRY_RUN: ${{ inputs.DRY_RUN }}
186196
ISSUE_ID: ${{ inputs.ISSUE_ID }}
197+
ISSUE_ID_LOOKUP: ${{ vars.ISSUE_ID_LOOKUP }}
198+
ISSUE_ID_LOOKUP_JSON: ${{ vars.ISSUE_ID_LOOKUP_JSON }}
187199
PR_NUMBER: ${{ inputs.PR_NUMBER }}
188200

189201
github2gerrit:
@@ -213,6 +225,8 @@ jobs:
213225
DRY_RUN: ${{ inputs.DRY_RUN }}
214226
ALLOW_DUPLICATES: ${{ inputs.ALLOW_DUPLICATES }}
215227
ISSUE_ID: ${{ inputs.ISSUE_ID }}
228+
ISSUE_ID_LOOKUP: ${{ inputs.ISSUE_ID_LOOKUP }}
229+
ISSUE_ID_LOOKUP_JSON: ${{ inputs.ISSUE_ID_LOOKUP_JSON }}
216230
GERRIT_SERVER: ${{ inputs.GERRIT_SERVER }}
217231
GERRIT_SERVER_PORT: ${{ inputs.GERRIT_SERVER_PORT }}
218232
GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ alignment between action inputs, environment variables, and CLI flags:
671671
| `CI_TESTING` | `CI_TESTING` | `--ci-testing` | No | `"false"` | Enable CI testing mode (overrides .gitreview) |
672672
| `ISSUE_ID` | `ISSUE_ID` | `--issue-id` | No | `""` | Issue ID to include (e.g., ABC-123) |
673673
| `ISSUE_ID_LOOKUP` | N/A | N/A | No | `"false"` | Enable Issue ID lookup via JSON table |
674-
| `ISSUE_ID_LOOKUP_JSON` | N/A | N/A | No | `"{}"` | JSON mapping of GitHub actors to Issue IDs |
674+
| `ISSUE_ID_LOOKUP_JSON` | N/A | N/A | No | `"[]"` | JSON array mapping GitHub actors to Issue IDs |
675675
| `G2G_USE_SSH_AGENT` | `G2G_USE_SSH_AGENT` | N/A | No | `"true"` | Use SSH agent for authentication |
676676
| `DUPLICATE_TYPES` | `DUPLICATE_TYPES` | `--duplicate-types` | No | `"open"` | Comma-separated Gerrit change states to check for duplicate detection |
677677
| `GERRIT_SERVER` | `GERRIT_SERVER` | `--gerrit-server` | No² | `""` | Gerrit server hostname (auto-derived if enabled) |
@@ -687,6 +687,10 @@ alignment between action inputs, environment variables, and CLI flags:
687687
1. Auto-derived when `G2G_ENABLE_DERIVATION=true` (default: true in all contexts)
688688
2. Optional if `.gitreview` file exists in repository
689689

690+
The format required for the JSON Issue-ID lookup is:
691+
692+
`[{"key": "username", "value": "ISSUE-ID"}]`
693+
690694
### Internal Environment Variables
691695

692696
The following environment variables control internal behavior but are not action inputs:
@@ -788,12 +792,12 @@ explicit `ISSUE_ID` exists:
788792
2. **Example JSON format:**
789793

790794
```json
791-
{
792-
"dependabot[bot]": "AUTO-123",
793-
"renovate[bot]": "AUTO-456",
794-
"alice": "PROJ-789",
795-
"bob": "PROJ-101"
796-
}
795+
[
796+
{ "key": "dependabot[bot]", "value": "AUTO-123" },
797+
{ "key": "renovate[bot]", "value": "AUTO-456" },
798+
{ "key": "alice", "value": "PROJ-789" },
799+
{ "key": "bob", "value": "PROJ-101" }
800+
]
797801
```
798802

799803
**Lookup Logic:**

action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ inputs:
114114
required: false
115115
default: "false"
116116
ISSUE_ID_LOOKUP_JSON:
117-
description: "JSON mapping of GitHub actors to Issue IDs"
117+
description: "JSON array mapping GitHub actors to Issue IDs"
118118
required: false
119-
default: "{}"
119+
default: "[]"
120120

121121
outputs:
122122
gerrit_change_request_url:

0 commit comments

Comments
 (0)