[IMP] server: canonicalize pattern filled paths #245
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: Alert on Specific File Change and Println Detection | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
check-file-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check for file changes | |
id: check_changes | |
run: | | |
if git diff --name-only HEAD^ HEAD | grep -E 'server/Cargo.toml|server/src/constants.rs'; then | |
echo "file_changed=true" >> $GITHUB_ENV | |
else | |
echo "file_changed=false" >> $GITHUB_ENV | |
fi | |
- name: Check for println occurrences | |
id: check_println | |
run: | | |
if git diff HEAD^ HEAD | grep -E 'println\!\('; then | |
echo "println_found=true" >> $GITHUB_ENV | |
else | |
echo "println_found=false" >> $GITHUB_ENV | |
fi | |
- name: Comment on PR if file changed or println detected | |
if: env.file_changed == 'true' || env.println_found == 'true' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
let body = ""; | |
if (process.env.file_changed === 'true') { | |
body += "⚠️ The file 'Cargo.toml or constant.rs' has been modified in this PR. Please review the changes carefully.\n"; | |
} | |
if (process.env.println_found === 'true') { | |
body += "⚠️ A 'println!(' statement was found in the commit. Please ensure debug statements are removed before merging.\n"; | |
} | |
github.rest.issues.createComment({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}); |