Skip to content

202312 action checking pr age #7

202312 action checking pr age

202312 action checking pr age #7

name: Check PR Age
on:
pull_request:
types:
- synchronize
- opened
- reopened
- labeled
- unlabeled
jobs:
check-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check PR Age and Label fast merge
run: |

Check failure on line 20 in .github/workflows/pr-timing-checker.yml

View workflow run for this annotation

GitHub Actions / Check PR Age

Invalid workflow file

The workflow is not valid. .github/workflows/pr-timing-checker.yml (Line: 20, Col: 14): Unexpected symbol: '$AGE_IN_DAYS'. Located at position 1 within expression: $AGE_IN_DAYS
PR_DATE=$(date -d "$(echo ${{ github.event.pull_request.created_at }})" +%s)
CURRENT_DATE=$(date +%s)
AGE_IN_SECONDS=$((CURRENT_DATE - PR_DATE))
AGE_IN_DAYS=$((AGE_IN_SECONDS / 86400))
if [ $AGE_IN_DAYS -lt 7 ]; then
if [[ $(echo "${{ github.event.pull_request.labels.*.name }}" | grep -c 'pr: fast merge') -eq 0 ]]; then
echo "PR is less than 7 days old (${{$AGE_IN_DAYS}}) and does not have the 'pr: fast merge' label."
echo "${{ github.event.pull_request.labels.*.name }}"
exit 1
fi
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}