Skip to content

Allow Dependabot PRs to skip release note validation #4985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/release-notes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,46 @@ jobs:
HAS_CHANGED_RELEASE_NOTES=$(echo $FILES_RESPONSE | jq '.[].filename' | jq -s '. | any(. == env.CURRENT_RELEASE_FILE_PATH)')
echo "HAS_CHANGED_RELEASE_NOTES=$HAS_CHANGED_RELEASE_NOTES" >> $GITHUB_OUTPUT

- name: Get PR Description
- name: Get PR Info
id: check-release-note-exceptions
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}}
run: |
PULLS_RESPONSE=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER)
DESCRIPTION_BODY=$(echo $PULLS_RESPONSE | jq '.body')
AUTHOR_ID=$(echo $PULLS_RESPONSE | jq -r '.user.login')

sudo apt-get install pandoc

BODY_WITHOUT_COMMENTS=$(printf "$DESCRIPTION_BODY" | pandoc --strip-comments -f markdown -t plain)
echo $DESCRIPTION_BODY
echo $BODY_WITHOUT_COMMENTS
echo $AUTHOR_ID

if $(echo $BODY_WITHOUT_COMMENTS | grep -Eq "RELEASE_NOTE_EXCEPTION="); then
HAS_RELEASE_NOTE_EXCEPTION_STRING=true
else
HAS_RELEASE_NOTE_EXCEPTION_STRING=false
fi

if [[ "$AUTHOR_ID" == "dependabot[bot]" ]] ; then
IS_DEPENDABOT_PR=true
else
IS_DEPENDABOT_PR=false
fi

echo "HAS_RELEASE_NOTE_EXCEPTION_STRING=$HAS_RELEASE_NOTE_EXCEPTION_STRING" >> $GITHUB_OUTPUT
echo "IS_DEPENDABOT_PR=$IS_DEPENDABOT_PR" >> $GITHUB_OUTPUT

- name: Check Release Preparedness requirements
env:
HAS_CHANGED_RELEASE_NOTES: ${{steps.get-modified-files.outputs.HAS_CHANGED_RELEASE_NOTES}}
HAS_RELEASE_NOTE_EXCEPTION_STRING: ${{steps.check-release-note-exceptions.outputs.HAS_RELEASE_NOTE_EXCEPTION_STRING}}
IS_DEPENDABOT_PR: ${{steps.check-release-note-exceptions.outputs.IS_DEPENDABOT_PR}}
run: |
if [ "$HAS_CHANGED_RELEASE_NOTES" != "true" ] && [ "$HAS_RELEASE_NOTE_EXCEPTION_STRING" != "true" ] ; then
if [ "$HAS_CHANGED_RELEASE_NOTES" != "true" ] && [ "$HAS_RELEASE_NOTE_EXCEPTION_STRING" != "true" ] && [ "$IS_DEPENDABOT_PR" != "true" ] ; then
echo "Release Preparedness check failed"
echo "::error file=$CURRENT_RELEASE_FILE_PATH,line=0,col=0,endColumn=0,title='Release Notes Weren\'t Modified'::Please add a release note entry to $CURRENT_RELEASE_FILE_PATH or an exception reason to your description using: \`RELEASE_NOTE_EXCEPTION=[reason goes here]\`"
echo "::error file=$CURRENT_RELEASE_FILE_PATH,line=0,col=0,endColumn=0,title='Release Notes were not Modified'::Please add a release note entry to $CURRENT_RELEASE_FILE_PATH or an exception reason to your description using: \`RELEASE_NOTE_EXCEPTION=[reason goes here]\`"
exit 1
fi