Enablement of Copilot Studio Samples #2
Workflow file for this run
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: Block zip files in samples | |
| on: | |
| pull_request: | |
| paths: | |
| - "samples/**" | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| check-zip-files: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Scan for zip files | |
| id: zip_check | |
| run: | | |
| set -euo pipefail | |
| if find samples -type f -name "*.zip" -print -quit | grep -q .; then | |
| echo "found=true" >> "$GITHUB_OUTPUT" | |
| echo "paths<<EOF" >> "$GITHUB_OUTPUT" | |
| find samples -type f -name "*.zip" -print >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "found=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Comment on PR if zip files found | |
| if: steps.zip_check.outputs.found == 'true' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const paths = `${{ steps.zip_check.outputs.paths }}`.trim(); | |
| const body = [ | |
| "Zip files are not allowed in `samples/**`. Please remove the following:", | |
| "", | |
| paths ? paths.split("\n").map(p => `- ${p}`).join("\n") : "- (no paths reported)" | |
| ].join("\n"); | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body | |
| }); |