Skip to content

Enablement of Copilot Studio Samples #2

Enablement of Copilot Studio Samples

Enablement of Copilot Studio Samples #2

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
});