test changed files ci #1
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: Check PR Changes | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| check-assets-updated: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get changed files | |
| id: changed | |
| uses: tj-actions/changed-files@v46 | |
| with: | |
| files_yaml: | | |
| posts: | |
| - docs/posts/** | |
| assets: | |
| - docs/assets/** | |
| readme: | |
| - README.md | |
| - name: Fail if docs/posts changed but docs/assets or README.md not changed | |
| if: steps.changed.outputs.posts_any_changed == 'true' | |
| run: | | |
| MISSING=() | |
| if [[ "${{ steps.changed.outputs.assets_any_changed }}" != "true" ]]; then | |
| MISSING+=("docs/assets") | |
| fi | |
| if [[ "${{ steps.changed.outputs.readme_any_changed }}" != "true" ]]; then | |
| MISSING+=("README.md") | |
| fi | |
| if [[ ${#MISSING[@]} -gt 0 ]]; then | |
| echo "❌ docs/posts was changed but the following required paths were not updated:" | |
| for m in "${MISSING[@]}"; do | |
| echo " - $m" | |
| done | |
| exit 1 | |
| fi | |
| echo "✅ All required files are updated alongside docs/posts." |