Skip to content

Commit

Permalink
Add new release notes format to release notes monitor (#17209)
Browse files Browse the repository at this point in the history
## Description 
Add new release notes format to release notes monitor

## Test plan 
https://github.com/MystenLabs/sui/actions/runs/8725971422
![Screenshot 2024-04-17 at 10 15
03 AM](https://github.com/MystenLabs/sui/assets/15659060/d3802e54-a62a-4828-8397-60fd9cce2748)
  • Loading branch information
ebmifa authored Apr 17, 2024
1 parent 82b6da4 commit ebbdee7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/release-notes-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,18 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Processing ${{ matrix.pr }} PR"
echo "Processing PR#${{ matrix.pr }}"
# old format
export rel_notes=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/MystenLabs/sui/pulls/${{ matrix.pr }} --jq ".body" | awk '/### Release notes/{p=1; next} p' | sed '/^[[:space:]]*$/d')
# new format
[[ -z $rel_notes ]] && export rel_notes=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/MystenLabs/sui/pulls/${{ matrix.pr }} --jq ".body" | awk '/^\- \[x\]/')
# make text json payload friendly
rel_notes="${rel_notes//\\/\\\\}"
rel_notes="${rel_notes//\"/\\\"}"
rel_notes="${rel_notes//$'\r'/}"
echo "release_notes=${rel_notes}" >> $GITHUB_ENV
- name: Configure AWS credentials
Expand All @@ -75,6 +85,13 @@ jobs:
run: |
export author=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/MystenLabs/sui/pulls/${{ matrix.pr }}} --jq ".user.login")
export slack_id=$(aws s3 cp s3://mysten-employees-dir/employees.json - | jq --arg AUTHOR "${author}" '.[] | if .github_handle == $AUTHOR then .slack_id else empty end')
# if we don't have the slack id or the author is not part of Mysten org, get the reviewer instead
if [ -z "$slack_id" ]; then
export reviewer=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/MystenLabs/sui/pulls/17148/reviews --jq ".[0].user.login")
export slack_id=$(aws s3 cp s3://mysten-employees-dir/employees.json - | jq --arg AUTHOR "${reviewer}" '.[] | if .github_handle == $AUTHOR then .slack_id else empty end')
fi
echo "slack_id=$(echo ${slack_id} | tr -d '"')" >> $GITHUB_ENV
- name: Post to a Slack channel
Expand All @@ -91,7 +108,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*PR* <https://github.com/MystenLabs/sui/pull/${{ matrix.pr }}|${{ matrix.pr }}> by <@${{ env.slack_id }}>\n<@U03LRLPR1QX> and <@U04A8V9E203> please review release notes for upcoming `v${{ needs.get-list-of-prs.outputs.sui_version }}` release.\n *Release Notes:*\n${{ env.release_notes }}\n"
"text": "*PR* <https://github.com/MystenLabs/sui/pull/${{ matrix.pr }}|${{ matrix.pr }}> by <@${{ env.slack_id }}>\n<@U03LRLPR1QX> and <@U04A8V9E203> please review release notes for upcoming `v${{ needs.get-list-of-prs.outputs.sui_version }}` release.\n *Release Notes:*\n${{ env.release_notes }}"
}
},
{
Expand Down

0 comments on commit ebbdee7

Please sign in to comment.