File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,33 +15,36 @@ jobs:
1515 env :
1616 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1717 run : |
18- missing=false
18+ missing_files=()
1919
2020 required_files=(
2121 "README.md"
2222 "CONTRIBUTING.md"
2323 ".gitignore"
2424 )
2525
26- echo "Checking required files in ${{ github.repository }}"
26+ echo "Checking required files in PR branch: ${{ github.head_ref }}"
2727
2828 for file in "${required_files[@]}"; do
2929 echo "Checking $file..."
3030
3131 status=$(curl -s -o /dev/null -w "%{http_code}" \
3232 -H "Authorization: token $GH_TOKEN" \
33- https://api.github.com/repos/${{ github.repository }}/contents/$file)
33+ " https://api.github.com/repos/${{ github.repository }}/contents/$file?ref=${{ github.head_ref }}" )
3434
3535 if [ "$status" != "200" ]; then
3636 echo "Missing: $file"
37- missing=true
37+ missing_files+=("$file")
3838 else
3939 echo "Found $file"
4040 fi
4141 done
4242
43- if [ "$missing" = true ]; then
44- echo "One or more required files are missing."
43+ if [ ${#missing_files[@]} -gt 0 ]; then
44+ echo "Missing files:"
45+ for f in "${missing_files[@]}"; do
46+ echo " - $f"
47+ done
4548 exit 1
4649 fi
4750
You can’t perform that action at this time.
0 commit comments