Testscript#777
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a test workflow for validating hardened PR processes and modifies comment formatting in PowerShell scripts. The changes include creating a comprehensive test workflow and updating comment styles in KQL validation scripts.
- Adds a new GitHub Actions workflow for testing hardened PR validation logic
- Updates comment formatting in PowerShell validation scripts from single
#to double##delimiters - Implements integrity checks and simulation capabilities for testing purposes
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/test-hardened-pr.yml | New test workflow implementing hardened PR validation with integrity checks and simulation capabilities |
| .github/scripts/validate-kql-syntax.ps1 | Updates comment formatting for the Az.ResourceGraph module installation |
| .github/scripts/validate-kql-comments.ps1 | Updates comment formatting for the Functions section header |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ref: main | ||
| fetch-depth: 1 | ||
|
|
||
| # 3) Simulate PR metadata (purely informational) | ||
| - name: Simulate PR Context | ||
| run: | | ||
| echo "Simulating PR #${{ github.event.inputs.simulate_pr_number }}" | ||
| echo "Base branch: main" |
There was a problem hiding this comment.
Hard-coded branch reference 'main' should be made configurable or use a dynamic reference like ${{ github.event.repository.default_branch }} to support repositories with different default branch names.
| ref: main | |
| fetch-depth: 1 | |
| # 3) Simulate PR metadata (purely informational) | |
| - name: Simulate PR Context | |
| run: | | |
| echo "Simulating PR #${{ github.event.inputs.simulate_pr_number }}" | |
| echo "Base branch: main" | |
| ref: ${{ github.event.repository.default_branch }} | |
| fetch-depth: 1 | |
| # 3) Simulate PR metadata (purely informational) | |
| - name: Simulate PR Context | |
| run: | | |
| echo "Simulating PR #${{ github.event.inputs.simulate_pr_number }}" | |
| echo "Base branch: ${{ github.event.repository.default_branch }}" |
| # 6) Conditional Execution Simulation (purely illustrative) | ||
| - name: Check Approval Condition (simulated) | ||
| run: | | ||
| echo "Simulating reviewDecision = APPROVED" | ||
| echo "PR approved" | ||
|
|
There was a problem hiding this comment.
This step serves no functional purpose and only outputs static simulation messages. Consider removing this step or making it perform actual validation logic if this workflow will be used for real testing scenarios.
| # 6) Conditional Execution Simulation (purely illustrative) | |
| - name: Check Approval Condition (simulated) | |
| run: | | |
| echo "Simulating reviewDecision = APPROVED" | |
| echo "PR approved" | |
| # 6) Check PR Approval Status (actual validation) | |
| - name: Check PR Approval Status | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.inputs.simulate_pr_number }} | |
| run: | | |
| echo "Checking approval status for PR #$PR_NUMBER" | |
| APPROVAL_COUNT=$(gh pr reviews $PR_NUMBER --json state --jq '[.[] | select(.state=="APPROVED")] | length') | |
| if [ "$APPROVAL_COUNT" -eq 0 ]; then | |
| echo "PR is NOT approved. Failing workflow." | |
| exit 1 | |
| else | |
| echo "PR is approved." | |
| fi |
Overview/Summary
Related Issues/Work Items
Breaking Changes
As part of this pull request I have
mainbranch