Files
awesome-copilot/.github/workflows/validate-readme.yml
Simon Kurtz 919fdb3f8e fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks (#1088)
* chore: publish from staged

* fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks

Co-authored-by: simonkurtz-MSFT <84809797+simonkurtz-MSFT@users.noreply.github.com>

* chore: publish from staged

* Clean plugins

* Clean plugins

* Clean plugins

* Fix gem-team plugin

* Reset README.plugins.md

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-03-23 10:37:40 +11:00

92 lines
2.7 KiB
YAML

name: Validate README.md
on:
pull_request:
branches: [staged]
types: [opened, synchronize, reopened]
paths:
- "instructions/**"
- "prompts/**"
- "agents/**"
- "plugins/**"
- "workflows/**"
- "*.js"
- "README.md"
- "docs/**"
- "skills/**"
jobs:
validate-readme:
permissions:
pull-requests: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Validate plugins
run: npm run plugin:validate
- name: Update README.md
run: npm start
- name: Check for file changes
id: check-diff
run: |
if git diff --exit-code; then
echo "No changes detected after running update script."
echo "status=success" >> $GITHUB_OUTPUT
else
echo "Changes detected after running update script."
echo "status=failure" >> $GITHUB_OUTPUT
echo "diff<<EOF" >> $GITHUB_OUTPUT
git diff >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
- name: Output diff to logs for non-write users
if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push != true
run: |
echo "::group::File changes (changes needed)"
echo "The following changes need to be made:"
echo ""
git diff
echo "::endgroup::"
- name: Comment on PR if files need updating
if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push == true
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
header: readme-validation
message: |
## ⚠️ Generated files need to be updated
The update script detected changes that need to be made.
Please run `npm start` locally and commit the changes before merging this PR.
<details>
<summary>View diff</summary>
```diff
${{ steps.check-diff.outputs.diff }}
```
</details>
- name: Fail workflow if files need updating
if: steps.check-diff.outputs.status == 'failure'
run: |
echo "❌ Generated files need to be updated. Please run `npm start` locally and commit the changes."
exit 1