vscode-insiders: update to 1.120.0.20260507 #11
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
| name: Template Check | |
| on: | |
| pull_request: | |
| paths: | |
| - 'vup/srcpkgs/**/*' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate Templates | |
| id: validate | |
| run: | | |
| git fetch origin main | |
| CHANGED=$(git diff --name-only origin/main...HEAD -- 'vup/srcpkgs/*/*/template') | |
| if [ -z "$CHANGED" ]; then | |
| echo "No template changes detected." | |
| echo "passed=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "Validating changed templates:" | |
| echo "$CHANGED" | |
| # Capture both stdout and exit code | |
| OUTPUT=$(python3 vup/scripts/validate_template.py $CHANGED 2>&1) && RC=$? || RC=$? | |
| echo "$OUTPUT" | |
| if [ $RC -ne 0 ]; then | |
| echo "passed=false" >> "$GITHUB_OUTPUT" | |
| # Save output for comment | |
| echo "$OUTPUT" > /tmp/validation-errors.txt | |
| exit 0 # Don't fail the step, we want to comment | |
| else | |
| echo "passed=true" >> "$GITHUB_OUTPUT" | |
| echo "$OUTPUT" > /tmp/validation-output.txt | |
| fi | |
| - name: Comment on Failure | |
| if: steps.validate.outputs.passed == 'false' | |
| uses: actions/github-script@v9 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| const errors = fs.readFileSync('/tmp/validation-errors.txt', 'utf8'); | |
| const prNumber = context.payload.pull_request.number; | |
| const marker = '<!-- template-check -->'; | |
| const body = [ | |
| marker, | |
| '### :x: Template Validation Failed', | |
| '', | |
| 'Your template has issues that must be fixed before this PR can be built:', | |
| '', | |
| '```', | |
| errors.trim(), | |
| '```', | |
| '', | |
| 'Fix the errors above, push your changes, and the check will re-run automatically.', | |
| ].join('\n'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| }); | |
| for (const comment of comments) { | |
| if (comment.user.type === 'Bot' && comment.body.includes(marker)) { | |
| await github.rest.issues.deleteComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: comment.id, | |
| }); | |
| } | |
| } | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: body, | |
| }); | |
| core.setFailed('Template validation failed.'); | |
| - name: Comment on Success | |
| if: steps.validate.outputs.passed == 'true' | |
| uses: actions/github-script@v9 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| const output = fs.readFileSync('/tmp/validation-output.txt', 'utf8'); | |
| const prNumber = context.payload.pull_request.number; | |
| const marker = '<!-- template-check -->'; | |
| const hasWarnings = output.includes('WARNING:'); | |
| const body = hasWarnings | |
| ? [ | |
| marker, | |
| '### :warning: Template Validation Passed (with warnings)', | |
| '', | |
| '```', | |
| output.trim(), | |
| '```', | |
| ].join('\n') | |
| : [ | |
| marker, | |
| '### :white_check_mark: Template Validation Passed', | |
| '', | |
| 'All required fields are present.', | |
| ].join('\n'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| }); | |
| for (const comment of comments) { | |
| if (comment.user.type === 'Bot' && comment.body.includes(marker)) { | |
| await github.rest.issues.deleteComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: comment.id, | |
| }); | |
| } | |
| } | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body: body, | |
| }); |