Skip to content
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

Fix invalid changelogs / update changelog workflows #1002

Merged
merged 6 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/chatops_commands.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- :ok_woman: `/approve` - approve
- :love_letter: `/changelog` - add changelog comment
- :love_letter: `/changelog` - replace the PR body by changelog details
- :bento: `/format` - format codes and add licenses
- :white_check_mark: `/gen-test` - generate test codes
- :label: `/label` - add labels
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/chatops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,21 @@ jobs:
PREVIOUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
BODY=`git log --pretty=format:'- %s' ${PREVIOUS_VERSION}..master | grep "#[[:digit:]]\+" | sed -e "s/\[\(patch\|minor\|major\)\] *//g" | sed -e "s%#\([[:digit:]]\+\)%[&](https://github.com/vdaas/vald/pull/\1)%g" | sed ':a;N;$!ba;s/\n/\\\\n/g'`
CURRENT="- ${PR_TITLE} ([#${PR_NUM}](https://github.com/vdaas/vald/pull/${PR_NUM}))"

curl --include --verbose --fail \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request PATCH \
--data "{\"body\": \"${CURRENT}\\n${BODY}\"}" \
https://api.github.com/repos/vdaas/vald/pulls/${PR_NUM}

curl --include --verbose --fail \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request POST \
--data "{\"body\": \"**[CHANGELOG]** Please edit the following lines.\\n${CURRENT}\\n${BODY}\"}" \
--data "{\"body\": \"**[CHANGELOG]** The description of this PR is updated. Please edit it.\"}" \
$API_URL
env:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ jobs:

BODY=""
if [ ! -z "${PR_NUM}" ]; then
PR_COMMENTS=`curl https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUM}/comments?per_page=10000`
BODY=`echo -E $PR_COMMENTS | jq 'last(.[] | select(.user.login == "vdaas-ci") | select(.body | test("^\\\\*\\\\*\\\\[CHANGELOG")))' -r | jq '.body'`
BODY=`echo -e $BODY | tail -n +2`
BODY=`curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUM}" | jq -r '.body'`
fi

if [ -z "$BODY" ]; then
Expand Down
Loading