Skip to content

ci: Add Bicep Parameter Validation Workflow and Script#499

Open
Harsh-Microsoft wants to merge 4 commits intodevfrom
hb-psl-38859
Open

ci: Add Bicep Parameter Validation Workflow and Script#499
Harsh-Microsoft wants to merge 4 commits intodevfrom
hb-psl-38859

Conversation

@Harsh-Microsoft
Copy link
Copy Markdown
Contributor

@Harsh-Microsoft Harsh-Microsoft commented Mar 31, 2026

Purpose

This pull request introduces a new GitHub Actions workflow to automate and improve the validation of Bicep parameter files in the repository. The workflow is triggered on a schedule, on pull requests to key branches, and can also be run manually. It validates parameter files, summarizes results, uploads artifacts, and sends notification emails based on the outcome.

New CI/CD workflow for Bicep parameter validation:

  • Adds .github/workflows/validate-bicep-params.yml to automatically validate all Bicep parameter files in the infra/ directory on a schedule, on PRs to main and dev, and via manual dispatch.
  • Runs a Python validation script in both standard and strict modes, summarizes the output, and uploads validation results as an artifact for further inspection.

Automated notifications and failure handling:

  • Sends email notifications via Logic App if the scheduled validation fails or succeeds, including detailed results and a link to the workflow run.
  • Fails the workflow if validation errors are detected, ensuring issues are caught early in the CI/CD process.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces an automated CI workflow to validate that infra/**/*.parameters.json parameter names match their corresponding Bicep param declarations, with artifacts and scheduled email notifications to surface issues early.

Changes:

  • Added infra/scripts/validate_bicep_params.py to discover Bicep/parameter-file pairs and validate mapping/casing/whitespace and some conventions.
  • Added .github/workflows/validate-bicep-params.yml to run the validator on PRs, on a weekly schedule, and via manual dispatch; publish results and (on schedule) notify via Logic App.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
infra/scripts/validate_bicep_params.py New Python validator for Bicep ↔ parameters.json mapping checks, reporting, and JSON output for CI artifacts.
.github/workflows/validate-bicep-params.yml New GitHub Actions workflow to run the validator (standard + strict), upload artifacts, and send scheduled notifications.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Harsh-Microsoft Harsh-Microsoft requested a review from Copilot March 31, 2026 11:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +20
workflow_dispatch:
push:
branches:
- hb-psl-38859

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow includes a push trigger limited to the feature branch hb-psl-38859, which doesn’t match the PR description (schedule/PR/manual) and will likely be stale after merge. Recommend removing this push trigger (or switching it to the intended long-lived branches) so the workflow behavior is consistent and maintainable.

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +88
- name: Send schedule notification on failure
if: steps.result.outputs.status == 'failure'
env:
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
ACCELERATOR_NAME: ${{ env.accelerator_name }}
run: |
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
INFRA_OUTPUT=$(sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' infra_output.txt)

jq -n \
--arg name "${ACCELERATOR_NAME}" \
--arg infra "$INFRA_OUTPUT" \
--arg url "$RUN_URL" \
'{subject: ("Bicep Parameter Validation Report - " + $name + " - Issues Detected"), body: ("<p>Dear Team,</p><p>The scheduled <strong>Bicep Parameter Validation</strong> for <strong>" + $name + "</strong> has detected parameter mapping errors.</p><p><strong>infra/ Results:</strong></p><pre>" + $infra + "</pre><p><strong>Run URL:</strong> <a href=\"" + $url + "\">" + $url + "</a></p><p>Please fix the parameter mapping issues at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>")}' \
| curl -X POST "${LOGICAPP_URL}" \
-H "Content-Type: application/json" \
-d @- || echo "Failed to send notification"

- name: Send schedule notification on success
if: steps.result.outputs.status == 'success'
env:
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The email notification steps run for all event types (pull_request, workflow_dispatch, and schedule) whenever validation succeeds/fails. This can create noise on PRs and can also invoke an external endpoint with repository secrets in PR contexts. If notifications are intended only for scheduled runs (as the step names/PR description suggest), gate these steps with github.event_name == 'schedule' (and optionally keep artifacts/step summary for PRs).

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants