Skip to content

Commit 18a9a9a

Browse files
authored
Another fix for the issue automation (#754)
The other labels were not being added. So, reverted to the original version of the action that worked, and added a separate step for the `needs review` label. ## GitHub issue number ## **Associated Risks** _Replace_ by possible risks this pull request can bring you might have thought of ## โœ… **PR Checklist** - [ ] **I have read the [contribution guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CONTRIBUTING.md)** - [ ] **I have read the [code of conduct guidelines](https://github.com/microsoft/azure-devops-mcp/blob/main/CODE_OF_CONDUCT.md)** - [ ] Title of the pull request is clear and informative. - [ ] ๐Ÿ‘Œ Code hygiene - [ ] ๐Ÿ”ญ Telemetry added, updated, or N/A - [ ] ๐Ÿ“„ Documentation added, updated, or N/A - [ ] ๐Ÿ›ก๏ธ Automated tests added, or N/A ## ๐Ÿงช **How did you test it?** _Replace_ with use cases tested and models used
1 parent 598bb2e commit 18a9a9a

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

โ€Ž.github/workflows/ai-issue-processing.ymlโ€Ž

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
1818

19+
- name: Add Needs Review Label
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
ISSUE_NUMBER: ${{ github.event.issue.number }}
23+
run: |
24+
gh issue edit $ISSUE_NUMBER --add-label "Needs Review ๐Ÿ‘“" --repo ${{ github.repository }}
25+
1926
- name: Call GitHub Model API
2027
id: ai-inference
2128
uses: actions/ai-inference@v1
@@ -36,16 +43,12 @@ jobs:
3643
run: |
3744
echo "AI Response: $AI_RESPONSE"
3845
39-
# Parse the JSON response to extract labels as a JSON array
40-
LABELS_JSON=$(echo "$AI_RESPONSE" | python3 -c "import sys, json; print(json.dumps(json.load(sys.stdin)['labels']))")
41-
42-
GH_COMMAND="gh issue edit $ISSUE_NUMBER"
43-
44-
# Add each label from the AI response
45-
echo "$LABELS_JSON" | python3 -c "import sys, json; [print(label) for label in json.load(sys.stdin)]" | while read -r label; do
46-
GH_COMMAND="$GH_COMMAND --add-label \"$label\""
47-
done
48-
49-
GH_COMMAND="$GH_COMMAND --add-label \"Needs Review ๐Ÿ‘“\" --remove-label \"ai-issue-processing\" --repo ${{ github.repository }}"
46+
# Parse the JSON response to extract labels
47+
LABELS=$(echo "$AI_RESPONSE" | python3 -c "import sys, json; print(' '.join([f'--add-label \"{label}\"' for label in json.load(sys.stdin)['labels']]))")
5048
51-
eval "$GH_COMMAND"
49+
# Add the recommended labels and remove the ai-issue-processing label
50+
if [ -n "$LABELS" ]; then
51+
eval gh issue edit $ISSUE_NUMBER $LABELS --remove-label "ai-issue-processing" --repo ${{ github.repository }}
52+
else
53+
gh issue edit $ISSUE_NUMBER --remove-label "ai-issue-processing" --repo ${{ github.repository }}
54+
fi

0 commit comments

Comments
ย (0)