-
Notifications
You must be signed in to change notification settings - Fork 157
Add automated template submission pipeline #799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jongio
wants to merge
5
commits into
Azure:main
Choose a base branch
from
jongio:template-submission-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
dc48c9b
Add automated template submission pipeline
jongio 618e15b
Add auto-extraction of template metadata from repo URL
jongio 0a8f5bf
Fix safeLookup for Node 24 dns.lookup {all:true} format
jongio 84f86c2
Add preview image extraction and framework detection
jongio fc307a6
Address Copilot review: harden SSRF, fix output injection, expand RFC…
jongio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| name: "Submit an azd Template" | ||
| description: "Add your azd template to the Awesome azd gallery" | ||
| title: "[Template]: " | ||
| labels: ["template-submission"] | ||
| body: | ||
| - type: markdown | ||
| attributes: | ||
| value: | | ||
| Thanks for submitting your azd template! Just provide the repository URL below. | ||
| Most fields are **auto-detected** from your repo — only fill them in if you want to override the detected values. | ||
|
|
||
| - type: input | ||
| id: source-repo | ||
| attributes: | ||
| label: "Source Repository" | ||
| description: "GitHub repository URL for your template (we'll auto-detect the rest!)" | ||
| placeholder: "https://github.com/org/repo" | ||
| validations: | ||
| required: true | ||
|
|
||
| - type: input | ||
| id: template-title | ||
| attributes: | ||
| label: "Template Title (optional — auto-detected from repo)" | ||
| description: "Override the auto-detected title" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: textarea | ||
| id: description | ||
| attributes: | ||
| label: "Description (optional — auto-detected from repo)" | ||
| description: "Override the auto-detected description" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: input | ||
| id: author | ||
| attributes: | ||
| label: "Author (optional — auto-detected from repo owner)" | ||
| description: "Override the auto-detected author name" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: input | ||
| id: author-url | ||
| attributes: | ||
| label: "Author URL (optional — auto-detected from repo owner)" | ||
| description: "Override the auto-detected author URL" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: dropdown | ||
| id: author-type | ||
| attributes: | ||
| label: "Author Type (optional — auto-detected)" | ||
| description: "Override the auto-detected author type" | ||
| options: | ||
| - "" | ||
| - Community | ||
| - Microsoft | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: input | ||
| id: preview-image | ||
| attributes: | ||
| label: "Preview Image URL (optional)" | ||
| description: "URL to an architecture diagram or screenshot" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: dropdown | ||
| id: iac-provider | ||
| attributes: | ||
| label: "IaC Provider (optional — auto-detected from infra/ directory)" | ||
| description: "Override the auto-detected IaC provider" | ||
| options: | ||
| - "" | ||
| - Bicep | ||
| - Terraform | ||
| - Both | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: input | ||
| id: languages | ||
| attributes: | ||
| label: "Languages (optional — auto-detected from repo)" | ||
| description: "Comma-separated language tags (e.g., python, javascript)" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: input | ||
| id: frameworks | ||
| attributes: | ||
| label: "Frameworks (optional)" | ||
| description: "Comma-separated framework tags (e.g., reactjs, fastapi)" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: input | ||
| id: azure-services | ||
| attributes: | ||
| label: "Azure Services (optional — auto-detected from repo topics)" | ||
| description: "Comma-separated Azure service tags (e.g., aca, openai)" | ||
| validations: | ||
| required: false | ||
|
|
||
| - type: textarea | ||
| id: additional-info | ||
| attributes: | ||
| label: "Additional Information" | ||
| description: "Any additional context about your template (optional)" | ||
| validations: | ||
| required: false | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,214 @@ | ||
| name: Template Submission | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened, labeled] | ||
| workflow_dispatch: | ||
| inputs: | ||
| source_repo: | ||
| description: "GitHub repository URL" | ||
| required: true | ||
| template_title: | ||
| description: "Template title (optional - auto-detected)" | ||
| required: false | ||
| description: | ||
| description: "Description (optional - auto-detected)" | ||
| required: false | ||
| author: | ||
| description: "Author name (optional - auto-detected)" | ||
| required: false | ||
| author_url: | ||
| description: "Author GitHub URL (optional - auto-detected)" | ||
| required: false | ||
| author_type: | ||
| description: "Microsoft or Community (optional - auto-detected)" | ||
| required: false | ||
| default: "" | ||
| type: choice | ||
| options: | ||
| - "" | ||
| - Community | ||
| - Microsoft | ||
| preview_image: | ||
| description: "Preview image URL (optional)" | ||
| required: false | ||
| iac_provider: | ||
| description: "IaC provider (optional - auto-detected)" | ||
| required: false | ||
| default: "" | ||
| type: choice | ||
| options: | ||
| - "" | ||
| - Bicep | ||
| - Terraform | ||
| - Both | ||
| languages: | ||
| description: "Comma-separated language tags (optional - auto-detected)" | ||
| required: false | ||
| frameworks: | ||
| description: "Comma-separated framework tags (optional)" | ||
| required: false | ||
| azure_services: | ||
| description: "Comma-separated Azure service tags (optional - auto-detected)" | ||
| required: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: template-submission | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| process-template: | ||
| if: >- | ||
| github.event_name == 'workflow_dispatch' || | ||
| contains(github.event.issue.labels.*.name, 'template-submission') | ||
| runs-on: ubuntu-latest | ||
jongio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@eca02f6b962f33b848cbe9e9f4dd5d23a0b61747 # v6 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@53b83942660f83e34d4f35ba9a3125d67d943f4c # v6 | ||
| with: | ||
| node-version: "24" | ||
|
|
||
| - name: Parse issue body | ||
| id: parse | ||
| env: | ||
| GITHUB_EVENT_NAME: ${{ github.event_name }} | ||
| ISSUE_BODY: ${{ github.event.issue.body || '' }} | ||
| INPUT_SOURCE_REPO: ${{ inputs.source_repo }} | ||
| INPUT_TEMPLATE_TITLE: ${{ inputs.template_title }} | ||
| INPUT_DESCRIPTION: ${{ inputs.description }} | ||
| INPUT_AUTHOR: ${{ inputs.author }} | ||
| INPUT_AUTHOR_URL: ${{ inputs.author_url }} | ||
| INPUT_AUTHOR_TYPE: ${{ inputs.author_type }} | ||
| INPUT_PREVIEW_IMAGE: ${{ inputs.preview_image }} | ||
| INPUT_IAC_PROVIDER: ${{ inputs.iac_provider }} | ||
| INPUT_LANGUAGES: ${{ inputs.languages }} | ||
| INPUT_FRAMEWORKS: ${{ inputs.frameworks }} | ||
| INPUT_AZURE_SERVICES: ${{ inputs.azure_services }} | ||
| run: node website/scripts/parse-template-issue.js | ||
|
|
||
| - name: Install extraction dependencies | ||
| run: cd website && npm ci --ignore-scripts | ||
|
|
||
| - name: Auto-extract metadata from repository | ||
| id: extract | ||
| env: | ||
| SOURCE_REPO: ${{ steps.parse.outputs.source_repo }} | ||
| FORM_TITLE: ${{ steps.parse.outputs.template_title }} | ||
| FORM_DESCRIPTION: ${{ steps.parse.outputs.description }} | ||
| FORM_AUTHOR: ${{ steps.parse.outputs.author }} | ||
| FORM_AUTHOR_URL: ${{ steps.parse.outputs.author_url }} | ||
| FORM_AUTHOR_TYPE: ${{ steps.parse.outputs.author_type }} | ||
| FORM_IAC_PROVIDER: ${{ steps.parse.outputs.iac_provider }} | ||
| FORM_LANGUAGES: ${{ steps.parse.outputs.languages }} | ||
| FORM_FRAMEWORKS: ${{ steps.parse.outputs.frameworks }} | ||
| FORM_AZURE_SERVICES: ${{ steps.parse.outputs.azure_services }} | ||
| FORM_PREVIEW_IMAGE: ${{ steps.parse.outputs.preview_image }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: node website/scripts/merge-extracted-metadata.js | ||
|
|
||
| - name: Validate template repository | ||
| id: validate | ||
| env: | ||
| SOURCE_REPO: ${{ steps.extract.outputs.source_repo }} | ||
| run: | | ||
| node website/scripts/validate-template.js "$SOURCE_REPO" > validation_result.json 2>validation_errors.log | ||
| if [ $? -ne 0 ]; then | ||
| echo "valid=false" >> $GITHUB_OUTPUT | ||
| { | ||
| echo 'errors<<EOF' | ||
| cat validation_result.json validation_errors.log | ||
| echo 'EOF' | ||
| } >> $GITHUB_OUTPUT | ||
| else | ||
| echo "valid=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Comment on validation failure | ||
| if: steps.validate.outputs.valid == 'false' && github.event_name != 'workflow_dispatch' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| ERRORS: ${{ steps.validate.outputs.errors }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| run: | | ||
| gh issue comment "$ISSUE_NUMBER" \ | ||
| --repo "$GITHUB_REPOSITORY" \ | ||
| --body "❌ **Template validation failed** | ||
|
|
||
| Please check your repository URL and try again. | ||
|
|
||
| \`\`\` | ||
| $ERRORS | ||
| \`\`\`" | ||
|
|
||
jongio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Update templates.json | ||
| id: update | ||
| if: steps.validate.outputs.valid == 'true' | ||
| env: | ||
| TPL_SOURCE_REPO: ${{ steps.extract.outputs.source_repo }} | ||
| TPL_TITLE: ${{ steps.extract.outputs.template_title }} | ||
| TPL_DESCRIPTION: ${{ steps.extract.outputs.description }} | ||
| TPL_AUTHOR: ${{ steps.extract.outputs.author }} | ||
| TPL_AUTHOR_URL: ${{ steps.extract.outputs.author_url }} | ||
| TPL_AUTHOR_TYPE: ${{ steps.extract.outputs.author_type }} | ||
| TPL_PREVIEW_IMAGE: ${{ steps.extract.outputs.preview_image }} | ||
| TPL_IAC_PROVIDER: ${{ steps.extract.outputs.iac_provider }} | ||
| TPL_LANGUAGES: ${{ steps.extract.outputs.languages }} | ||
| TPL_FRAMEWORKS: ${{ steps.extract.outputs.frameworks }} | ||
| TPL_AZURE_SERVICES: ${{ steps.extract.outputs.azure_services }} | ||
| run: node website/scripts/update-templates-json.js | ||
|
|
||
| - name: Create Pull Request | ||
| id: create-pr | ||
| if: steps.validate.outputs.valid == 'true' && steps.update.outputs.skipped != 'true' | ||
| uses: peter-evans/create-pull-request@e0fcfd740c5df573cb2b99ba5cf7bd41528dd2b3 # v8 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: "Add template from ${{ github.event_name == 'workflow_dispatch' && 'manual dispatch' || format('issue #{0}', github.event.issue.number) }}" | ||
| branch: "template-submission-${{ github.event_name == 'workflow_dispatch' && github.run_id || github.event.issue.number }}" | ||
| title: "Add template: ${{ steps.extract.outputs.template_title }}" | ||
| body: | | ||
| This PR was automatically generated${{ github.event_name != 'workflow_dispatch' && format(' from issue #{0}', github.event.issue.number) || '' }}. | ||
|
|
||
| **Source Repository**: ${{ steps.extract.outputs.source_repo }} | ||
| **Title**: ${{ steps.extract.outputs.template_title }} | ||
| **Author**: ${{ steps.extract.outputs.author }} | ||
| **IaC**: ${{ steps.extract.outputs.iac_provider }} | ||
| **Added**: ${{ steps.update.outputs.added || 'None' }} | ||
|
|
||
| Please review the changes to `website/static/templates.json`. | ||
| labels: template-submission | ||
|
|
||
| - name: Comment on success | ||
| if: steps.validate.outputs.valid == 'true' && steps.update.outputs.skipped != 'true' && github.event_name != 'workflow_dispatch' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| run: | | ||
| gh issue comment "$ISSUE_NUMBER" \ | ||
| --repo "$GITHUB_REPOSITORY" \ | ||
| --body "✅ **Template validated successfully!** | ||
|
|
||
| A pull request has been created to add your template to the gallery. It will be reviewed by the maintainers shortly." | ||
|
|
||
| - name: Comment on duplicate | ||
| if: steps.update.outputs.skipped == 'true' && github.event_name != 'workflow_dispatch' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| SKIP_REASON: ${{ steps.update.outputs.skip_reason }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| run: | | ||
| gh issue comment "$ISSUE_NUMBER" \ | ||
| --repo "$GITHUB_REPOSITORY" \ | ||
| --body "⚠️ **Template submission skipped** | ||
|
|
||
| $SKIP_REASON | ||
|
|
||
| If you believe this is an error, please comment on this issue." | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| module.exports = { | ||
| testMatch: ['<rootDir>/test/**/*.test.ts'] | ||
| testMatch: ['<rootDir>/test/**/*.test.ts'], | ||
| transformIgnorePatterns: [ | ||
| 'node_modules/(?!@babel/runtime/helpers/esm)' | ||
| ] | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.