Skip to content

Commit 8bc2b3e

Browse files
wangyb-AAlex Wang
andauthored
Add slack notification workflow (#197)
Co-authored-by: Alex Wang <wangyb@amazon.com>
1 parent 5e184cb commit 8bc2b3e

4 files changed

Lines changed: 49 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python-version: ${{ matrix.python-version }}
2929
- name: Install Hatch
3030
run: |
31-
python -m pip install hatch==1.15.0
31+
python -m pip install hatch==1.16.5
3232
- uses: webfactory/ssh-agent@v0.9.1
3333
with:
3434
ssh-private-key: ${{ secrets.SDK_KEY }}

.github/workflows/notify_slack.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Slack Notifications
2+
3+
on:
4+
issues:
5+
types: [opened, reopened, edited]
6+
pull_request_target:
7+
types: [opened, reopened, synchronize]
8+
9+
permissions: {}
10+
11+
jobs:
12+
notify:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Send issue notification to Slack
16+
if: github.event_name == 'issues'
17+
uses: slackapi/slack-github-action@v2.1.1
18+
with:
19+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_ISSUE }}
20+
webhook-type: incoming-webhook
21+
payload: |
22+
{
23+
"action": "${{ github.event.action }}",
24+
"issue_url": "${{ github.event.issue.html_url }}",
25+
"package_name": "${{ github.repository }}"
26+
}
27+
28+
- name: Send pull request notification to Slack
29+
if: github.event_name == 'pull_request_target'
30+
uses: slackapi/slack-github-action@v2.1.1
31+
with:
32+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_PR }}
33+
webhook-type: incoming-webhook
34+
payload: |
35+
{
36+
"action": "${{ github.event.action }}",
37+
"pr_url": "${{ github.event.pull_request.html_url }}",
38+
"package_name": "${{ github.repository }}"
39+
}

tests/web/handlers_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,9 +2381,9 @@ def test_handler_naming_matches_smithy_operations():
23812381
for handler_name in handler_names:
23822382
assert hasattr(handlers, handler_name), f"Handler {handler_name} not found"
23832383
handler_class = getattr(handlers, handler_name)
2384-
assert issubclass(
2385-
handler_class, EndpointHandler
2386-
), f"{handler_name} should inherit from EndpointHandler"
2384+
assert issubclass(handler_class, EndpointHandler), (
2385+
f"{handler_name} should inherit from EndpointHandler"
2386+
)
23872387

23882388

23892389
def test_all_handlers_have_executor():
@@ -2408,9 +2408,9 @@ def test_all_handlers_have_executor():
24082408

24092409
for handler_class in handlers_to_test:
24102410
handler = handler_class(executor)
2411-
assert (
2412-
handler.executor == executor
2413-
), f"{handler_class.__name__} should store executor reference"
2411+
assert handler.executor == executor, (
2412+
f"{handler_class.__name__} should store executor reference"
2413+
)
24142414

24152415

24162416
class MockExceptionHandler(EndpointHandler):

tests/web/routes_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,9 @@ def test_router_constructor_with_all_default_route_types():
919919

920920
for path, method, expected_type in test_cases:
921921
route = router.find_route(path, method)
922-
assert isinstance(
923-
route, expected_type
924-
), f"Expected {expected_type.__name__} for {method} {path}"
922+
assert isinstance(route, expected_type), (
923+
f"Expected {expected_type.__name__} for {method} {path}"
924+
)
925925

926926

927927
def test_router_constructor_with_subset_of_route_types():

0 commit comments

Comments
 (0)