Skip to content

[mainnet] - ETH Recovery Execution Task #136

[mainnet] - ETH Recovery Execution Task

[mainnet] - ETH Recovery Execution Task #136

name: Check Post-Check Implementation
on:
pull_request:
paths:
- "**/*.sol"
permissions:
contents: read
jobs:
check-post-check:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.ref }}
- name: Fetch base branch
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
- name: Check for _postCheck implementation
run: |
# Get all Solidity files that have been modified or added in the PR
FILES=$(git diff --name-only --diff-filter=AMR ${{ github.event.pull_request.base.ref }} | grep '\.sol$')
# Initialize error flag
ERROR=0
for file in $FILES; do
# Skip if file doesn't exist (was deleted)
if [ ! -f "$file" ]; then
continue
fi
# Create a temporary file with comments removed
# This removes both single-line and multi-line comments
sed -E '/\/\*/,/\*\//d' "$file" | sed '/\/\//d' > "${file}.tmp"
# Check if _postCheck function is properly implemented (not in comments)
# Look for a line that starts with "function _postCheck" (ignoring whitespace)
# and contains an opening brace anywhere after it
if ! grep -A10 -E '^\s*function\s+_postCheck' "${file}.tmp" | grep -q '{'; then
echo "❌ Error: $file is missing the required _postCheck function implementation"
ERROR=1
fi
# Clean up temporary file
rm "${file}.tmp"
done
if [ $ERROR -eq 1 ]; then
echo "::error::Some script files are missing the required _postCheck function implementation"
exit 1
fi
echo "✅ All script files properly implement the _postCheck function"