Skip to content

Commit b32526b

Browse files
[generate_manifest] let issue creation trigger the workflow (#245)
* [generate_manifest] let issue creation trigger the workflow * Potential fix for code scanning alert no. 10: Code injection Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent cabec4c commit b32526b

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

.github/workflows/generate-manifest.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ on:
99
type: string
1010
repository_dispatch:
1111
types: [generate-manifest]
12+
issues:
13+
types: [opened, labeled]
1214

1315
jobs:
1416
generate-manifest:
1517
runs-on: ubuntu-latest
18+
if: ${{ github.event_name != 'issues' || contains(github.event.issue.labels.*.name, 'server submission') }}
1619
permissions:
1720
contents: write
1821
pull-requests: write
@@ -40,17 +43,34 @@ jobs:
4043
python -m pip install --upgrade pip
4144
pip install requests
4245
46+
- name: Extract repository URL from issue
47+
id: extract-url
48+
if: github.event_name == 'issues'
49+
env:
50+
ISSUE_BODY: ${{ github.event.issue.body }}
51+
run: |
52+
# Extract the repository URL from the GitHub issue form
53+
# The form renders the repository field as a URL line after the label
54+
REPO_URL=$(echo "$ISSUE_BODY" | grep -oP 'https://github\.com/[^\s]+' | head -1)
55+
if [ -z "$REPO_URL" ]; then
56+
echo "No GitHub repository URL found in issue body"
57+
echo "Issue body: $ISSUE_BODY"
58+
exit 1
59+
fi
60+
echo "Found repository URL: $REPO_URL"
61+
echo "repo_url=$REPO_URL" >> $GITHUB_OUTPUT
62+
4363
- name: Generate manifest
4464
env:
4565
ANYON_API_KEY: ${{ secrets.ANYON_API_KEY }}
4666
run: |
47-
REPO_URL="${{ github.event.inputs.repo_url || github.event.client_payload.repo_url }}"
67+
REPO_URL="${{ github.event.inputs.repo_url || github.event.client_payload.repo_url || steps.extract-url.outputs.repo_url }}"
4868
python scripts/get_manifest.py "$REPO_URL"
4969
5070
- name: Extract repo name for branch
5171
id: repo-info
5272
run: |
53-
REPO_URL="${{ github.event.inputs.repo_url || github.event.client_payload.repo_url }}"
73+
REPO_URL="${{ github.event.inputs.repo_url || github.event.client_payload.repo_url || steps.extract-url.outputs.repo_url }}"
5474
REPO_NAME=$(echo "$REPO_URL" | sed 's/.*github\.com[:/]//' | sed 's/\.git$//' | tr '/' '-')
5575
echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
5676
echo "branch_name=add-manifest-$REPO_NAME" >> $GITHUB_OUTPUT
@@ -62,14 +82,14 @@ jobs:
6282
commit-message: |
6383
feat: add manifest for ${{ steps.repo-info.outputs.repo_name }}
6484
65-
Generated manifest JSON for repository: ${{ github.event.inputs.repo_url || github.event.client_payload.repo_url }}
85+
Generated manifest JSON for repository: ${{ github.event.inputs.repo_url || github.event.client_payload.repo_url || steps.extract-url.outputs.repo_url }}
6686
6787
Co-Authored-By: Lucien
6888
title: "feat: Add MCP manifest for ${{ steps.repo-info.outputs.repo_name }}"
6989
body: |
7090
## Summary
7191
72-
This PR adds a new MCP server manifest generated from the repository: ${{ github.event.inputs.repo_url || github.event.client_payload.repo_url }}
92+
This PR adds a new MCP server manifest generated from the repository: ${{ github.event.inputs.repo_url || github.event.client_payload.repo_url || steps.extract-url.outputs.repo_url }}
7393
7494
## Changes
7595

0 commit comments

Comments
 (0)