Skip to content

Commit 4c3c8fa

Browse files
authored
pull request template + release notes -> slack workflow (#156)
* Create pull_release_template.md * Create slack_release_notes.yml
1 parent 0bd87d8 commit 4c3c8fa

2 files changed

Lines changed: 153 additions & 0 deletions

File tree

.github/pull_release_template.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!---
2+
Provide Title above, ensure it summarizes the work in the PR. Example PR titles templates:
3+
* "feature/ (or build/): describe new functionality"
4+
* "hotfix/: describe issue fix for immediate release"
5+
* "bugfix/ (or fix/): describe issue fix, not necessary for immediate release"
6+
* "docs/: adding or updating documentation"
7+
-->
8+
9+
## Description & motivation
10+
<!---
11+
High level description your PR, and why you're making it. Is this linked to slack thread, Monday board, open
12+
issue, a continuation to a previous PR? Link it here if relevant (use the "#" symbol for issues/PRs).
13+
-->
14+
15+
## Breaking changes introduced by this PR:
16+
<!---
17+
Describe any breaking changes that are introduced. Take a wide approach to what might be 'breaking'. One example of a 'hidden' breaking change could be adding a new column. For most applications, this will not cause error, but if someone has configured a downstream query that references this column name from elsewhere, their query could break.
18+
19+
Make sure to include these breaking changes in the CHANGELOG.md
20+
-->
21+
22+
## PR Merge Priority:
23+
<!---
24+
This checklist helps the reviewers understand the level of priority for merging this PR.
25+
A loose description of merging priority levels is:
26+
Low: A week or more.
27+
Medium: Within 3 days or less.
28+
High: As soon as possible.
29+
-->
30+
- [ ] Low
31+
- [ ] Medium
32+
- [ ] High
33+
34+
<!---
35+
If High Priority, explain why as a comment below.
36+
-->
37+
38+
## Changes to existing files:
39+
<!---
40+
Include this section if you are changing any existing files or creating breaking changes to existing files. Label the model name and describe the logic behind the changes made, try to be very descriptive here. For example:
41+
- `stg_model` : Describe any changes made to `stg_model` and why the changes where made.
42+
- `src_staging` : Describe any changes made to `src_staging` and why the changes where made.
43+
-->
44+
45+
## New files created:
46+
<!---
47+
Include this section if you are creating any new files. Label the model name and describe the logic behind the changes made, try to be very descriptive here. For example:
48+
- `stg_new_model` : Describe the purpose of `stg_new_model` and the logic behind creating the model.
49+
- `src_new_staging` : Describe the purpose of `src_new_staging`.
50+
-->
51+
52+
## Tests and QC done:
53+
<!---
54+
Describe any process that confirms that the files do what is expected, include screenshots if relevant. For example:
55+
- Analyst replication confirmed that updates to `stg_model` new counts were correct.
56+
- Executed a dbt project run and ensured it was successful.
57+
-->
58+
59+
## edu_edfi_source PR Review Checklist:
60+
Make sure the following have been completed before approving this PR:
61+
- [ ] Description of changes has been added to Unreleased section of [CHANGELOG.md](/CHANGELOG.md). Add under `## New Features` for features, etc.
62+
- [ ] Code has been tested/checked for Databricks and Snowflake compatibility - EA engineers see Databricks checklist [here](https://edanalytics.slite.com/app/docs/LRjXFxVRAWA5ST)
63+
- [ ] Reviewer confirms the grain of all tables are unchanged, OR any changes are expected, communicated, and this PR is flagged as a breaking change (not for patch release)
64+
65+
<!---## Future ToDos & Questions:-->
66+
<!---
67+
[Optional] Include any future steps and questions related to this PR.
68+
-->
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Notify Slack on Latest Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
notify-slack:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Fetch latest published release
14+
id: get_release
15+
run: |
16+
echo "🔍 Getting latest published release..."
17+
curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
18+
-H "Accept: application/vnd.github+json" \
19+
https://api.github.com/repos/${{ github.repository }}/releases \
20+
| jq '[.[] | select(.draft == false and .prerelease == false)][0]' > release.json
21+
22+
echo "RELEASE_NAME<<EOF" >> $GITHUB_ENV
23+
jq -r .name release.json >> $GITHUB_ENV
24+
echo "EOF" >> $GITHUB_ENV
25+
26+
echo "RELEASE_URL<<EOF" >> $GITHUB_ENV
27+
jq -r .html_url release.json >> $GITHUB_ENV
28+
echo "EOF" >> $GITHUB_ENV
29+
30+
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
31+
jq -r .body release.json >> $GITHUB_ENV
32+
echo "EOF" >> $GITHUB_ENV
33+
34+
- name: Print resolved values (debug)
35+
run: |
36+
echo "RELEASE_NAME: $RELEASE_NAME"
37+
echo "RELEASE_URL: $RELEASE_URL"
38+
echo "RELEASE_BODY:"
39+
echo "$RELEASE_BODY"
40+
41+
- name: Send release info to Slack
42+
run: |
43+
pip install slack-sdk markdown2slack
44+
python3 << 'EOF'
45+
import os
46+
from slack_sdk.webhook import WebhookClient
47+
from markdown2slack.app import Convert
48+
49+
# Create converter instance
50+
converter = Convert()
51+
52+
webhook = WebhookClient(os.environ['SLACK_WEBHOOK_URL'])
53+
54+
# Convert markdown to Slack format
55+
slack_formatted = converter.markdown_to_slack_format(os.environ['RELEASE_BODY'])
56+
57+
response = webhook.send(
58+
text=f"New release published: {os.environ['RELEASE_NAME']}",
59+
blocks=[
60+
{
61+
"type": "section",
62+
"text": {
63+
"type": "mrkdwn",
64+
"text": f"*New EDU Release:* <{os.environ['RELEASE_URL']}|{os.environ['RELEASE_NAME']}>"
65+
}
66+
},
67+
{
68+
"type": "divider"
69+
},
70+
{
71+
"type": "section",
72+
"text": {
73+
"type": "mrkdwn",
74+
"text": slack_formatted
75+
}
76+
}
77+
]
78+
)
79+
print(f"Response: {response.status_code}")
80+
EOF
81+
env:
82+
RELEASE_NAME: ${{ env.RELEASE_NAME }}
83+
RELEASE_URL: ${{ env.RELEASE_URL }}
84+
RELEASE_BODY: ${{ env.RELEASE_BODY }}
85+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)