Skip to content

Update changelog.yml #33

Update changelog.yml

Update changelog.yml #33

Workflow file for this run

name: Check PR for Changelog
on:
push:
pull_request:
types: [opened, edited, reopened]
jobs:
check-description:
runs-on: ubuntu-latest
if: github.event_name == "pull_request"

Check failure on line 11 in .github/workflows/changelog.yml

View workflow run for this annotation

GitHub Actions / Check PR for Changelog

Invalid workflow file

The workflow is not valid. .github/workflows/changelog.yml (Line: 11, Col: 9): Unexpected symbol: '"pull_request"'. Located at position 22 within expression: github.event_name == "pull_request"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check PR Description
id: check_description
run: |
description=$(jq -r ".pull_request.body" "$GITHUB_EVENT_PATH" | awk '/## Changelog/{flag=1; next} /##/{flag=0} flag' | grep -oP '(?<=- \*\*Description:\*\* ).*' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
echo "$description"
default_description="Summary of change(s)"
if [ -n "$description" ] && [ "$description" != "$default_description" ]; then
echo "containsChangelog=true" >> $GITHUB_OUTPUT
else
echo "containsChangelog=false" >> $GITHUB_OUTPUT
fi
- name: Results
run: |
if [[ "${{ steps.check_description.outputs.containsChangelog }}" == "true" || "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then
echo "PR contains Changelog section/ PR made by Dependabot"
exit 0
else
echo "Changelog section is missing or does not contain the required details"
exit 1
fi