Skip to content

Issue 325 gopreprocess #8

Issue 325 gopreprocess

Issue 325 gopreprocess #8

name: Check Jenkins Watchdog Step
on:
pull_request:
paths:
- 'Jenkinsfile'
jobs:
check-modifications:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Fetch master branch
run: git fetch origin master:master
- name: Check for modifications in the watchdog function
run: |
MODIFIED_LINES=$(git diff --unified=0 master issue-325-gopreprocess Jenkinsfile | grep 'void watchdog()')
# Debug: Print the entire git diff output for Jenkinsfile
echo "Full git diff output for Jenkinsfile:"
git diff --unified=0 master issue-325-gopreprocess Jenkinsfile
echo "-------------------------"
if [[ ! -z "$MODIFIED_LINES" ]]; then
echo "ERROR: The watchdog function in the Jenkinsfile has been modified."
exit 1
else
echo "watchdog OK"
exit 0
fi