Skip to content

Commit e9b3a6b

Browse files
zimegFil Maj
and
Fil Maj
authored
feat!: wrap payloads to send to a "method" with "token" or "webhook" (#333)
Co-authored-by: Fil Maj <[email protected]>
1 parent 74ae656 commit e9b3a6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5088
-7410
lines changed

.c8rc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"include": ["src/*.js"],
3+
"exclude": ["**/*.spec.js"],
4+
"reporter": ["lcov", "text"],
5+
"all": false,
6+
"cache": true
7+
}

.eslintignore

-2
This file was deleted.

.eslintrc.js

-132
This file was deleted.

.github/maintainers_guide.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ All you need to work with this project is a supported version of [Node.js](https
1313

1414
### Developing
1515

16-
Iterate quickly by developing and testing a local version of this action using `npm run local`.
17-
Information on setting up and configuring mocked events can be found in [`.github/workflows/local/README.md`](./workflows/local/README.md).
16+
Iterate quickly by developing and testing all techniques of this action with a local version of this action using `npm run dev`.
17+
Information on setting up and configuring mocked events can be found in [`.github/resources/README.md`](./resources/README.md).
1818

1919
### Testing
2020

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Summary
1+
### Summary
22

33
Describe the goal of this PR. Mention any related Issue numbers.
44

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"pull_request": {
3-
"user": {
4-
"login": "dependabot"
5-
},
63
"title": "Bump actions/checkout from 3 to 4",
74
"html_url": "https://github.com/slackapi/slack-github-action/pull/238"
5+
},
6+
"repository": {
7+
"full_name": "slackapi/slack-github-action"
8+
},
9+
"sender": {
10+
"login": "dependabot"
811
}
912
}

.github/resources/.env.example

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Move this file to .env before starting
2+
3+
# https://api.slack.com/apps/A0123456789
4+
export SLACK_BOT_TOKEN=xoxb-01010101-example
5+
export SLACK_CHANNEL_ID=C0123456789
6+
export SLACK_INCOMING_WEBHOOK=https://hooks.slack.com/services/T0123456789/B0123456789/abcdefghijklmnopqrstuvwxyz
7+
export SLACK_WEBHOOK_TRIGGER=https://hooks.slack.com/triggers/T0123456789/00000000000/abcdefghijklmnopqrstuvwxyz

.github/resources/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Application values
2+
.env.*
3+
.env
4+
!.env.example
5+
.slack/apps.json
6+
.slack/apps.*.json

.github/resources/.slack/config.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"experiments": ["bolt"],
3+
"project_id": "c4805b41-d1ce-4ea0-b297-ed2f8c64c267"
4+
}
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"text": ":email: A GitHub Action `${{ github.eventName }}` event status is ${{ env.JOB_STATUS }}",
3+
"attachments": [
4+
{
5+
"color": "${{ env.ATTACHMENT_COLOR }}",
6+
"fields": [
7+
{
8+
"title": "Repository",
9+
"short": false,
10+
"value": "<${{ github.payload.repository.html_url }}|${{ github.payload.repository.full_name }}>"
11+
},
12+
{
13+
"title": "Ref",
14+
"short": false,
15+
"value": "${{ github.ref }}"
16+
},
17+
{
18+
"title": "Commit",
19+
"short": false,
20+
"value": "<${{ github.payload.repository.html_url }}/commit/${{ github.sha }}|${{ github.sha }}>"
21+
},
22+
{
23+
"title": "Author",
24+
"short": false,
25+
"value": "<https://github.com/${{ github.actor }}|${{ github.actor }}>"
26+
},
27+
{
28+
"title": "Workflow",
29+
"short": false,
30+
"value": "<${{ github.payload.repository.html_url }}/actions/runs/${{ github.runId }}|${{ github.workflow }}>"
31+
}
32+
]
33+
}
34+
]
35+
}
+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"_metadata": {
3+
"major_version": 2
4+
},
5+
"display_information": {
6+
"name": "slacktion",
7+
"description": "an application for developing the Slack GitHub Action"
8+
},
9+
"features": {
10+
"app_home": {
11+
"messages_tab_enabled": true,
12+
"messages_tab_read_only_enabled": true
13+
},
14+
"bot_user": {
15+
"display_name": "slacktion"
16+
}
17+
},
18+
"oauth_config": {
19+
"scopes": {
20+
"bot": [
21+
"chat:write",
22+
"chat:write.public",
23+
"files:write",
24+
"incoming-webhook",
25+
"reactions:write"
26+
]
27+
}
28+
},
29+
"settings": {
30+
"org_deploy_enabled": true,
31+
"incoming_webhooks": {
32+
"incoming_webhooks_enabled": true
33+
}
34+
},
35+
"workflows": {
36+
"event_notifications": {
37+
"title": "GitHub event notifications",
38+
"description": "A new changeset has been discovered",
39+
"input_parameters": {
40+
"properties": {
41+
"author": {
42+
"type": "string"
43+
},
44+
"channel_id": {
45+
"type": "slack#/types/channel_id"
46+
},
47+
"repo_name": {
48+
"type": "string"
49+
},
50+
"status": {
51+
"type": "string"
52+
},
53+
"event_url": {
54+
"type": "string"
55+
}
56+
},
57+
"required": ["author", "channel_id", "repo_name", "status", "event_url"]
58+
},
59+
"steps": [
60+
{
61+
"id": "0",
62+
"function_id": "slack#/functions/send_message",
63+
"inputs": {
64+
"channel_id": "{{inputs.channel_id}}",
65+
"message": ":ship: {{inputs.repo_name}}(@{{inputs.author}}): `{{inputs.status}}` <{{inputs.event_url}}|Check it out here>!"
66+
}
67+
}
68+
]
69+
}
70+
}
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"type": "webhook",
3+
"name": "Post the latest actions from GitHub",
4+
"description": "Share event information to a channel",
5+
"workflow": "#/workflows/event_notifications",
6+
"inputs": {
7+
"author": {
8+
"value": "{{data.author}}"
9+
},
10+
"channel_id": {
11+
"value": "{{data.channel_id}}"
12+
},
13+
"repo_name": {
14+
"value": "{{data.repo_name}}"
15+
},
16+
"status": {
17+
"value": "{{data.status}}"
18+
},
19+
"event_url": {
20+
"value": "{{data.event_url}}"
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)