awesome-copilot/.github/workflows/validate-readme.yml
Copilot dfe63f4542
Implement Collections feature for grouping related prompts, instructions, and chat modes (#232)
* Initial plan

* Implement core Collections feature with YAML parsing and README generation

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>

* Complete Collections feature implementation with validation, tooling, and documentation

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>

* Update generated README files to include collections instructions

* Fix YAML parsing logic bug: replace impossible condition with proper indentation check

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>

* Refactor: Extract YAML parser to shared module and improve user experience

Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>

* fixing task and file permissions

* Better args handling

* Adding some more collections

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: Aaron Powell <me@aaron-powell.com>
2025-09-17 10:15:34 +10:00

84 lines
2.6 KiB
YAML

name: Validate README.md
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "instructions/**"
- "prompts/**"
- "chatmodes/**"
- "collections/**"
- "*.js"
jobs:
validate-readme:
permissions:
pull-requests: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Validate collections
run: node validate-collections.js
- name: Update README.md
run: node update-readme.js
- name: Check for README.md changes
id: check-diff
run: |
if git diff --exit-code README.md; then
echo "No changes to README.md after running update script."
echo "status=success" >> $GITHUB_OUTPUT
else
echo "Changes detected in README.md after running update script."
echo "status=failure" >> $GITHUB_OUTPUT
echo "diff<<EOF" >> $GITHUB_OUTPUT
git diff README.md >> $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::README.md diff (changes needed)"
echo "The following changes need to be made to README.md:"
echo ""
git diff README.md
echo "::endgroup::"
- name: Comment on PR if README.md needs updating
if: steps.check-diff.outputs.status == 'failure' && github.event.pull_request.head.repo.permissions.push == true
uses: marocchino/sticky-pull-request-comment@v2
with:
header: readme-validation
message: |
## ⚠️ README.md needs to be updated
The `update-readme.js` script detected changes that need to be made to the README.md file.
Please run `node update-readme.js` 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 README.md needs updating
if: steps.check-diff.outputs.status == 'failure'
run: |
echo "❌ README.md needs to be updated. Please run 'node update-readme.js' locally and commit the changes."
exit 1