Skip to content

Commit

Permalink
feat!: wrap payloads to send to a "method" with "token" or "webhook" (#…
Browse files Browse the repository at this point in the history
…333)

Co-authored-by: Fil Maj <[email protected]>
  • Loading branch information
zimeg and filmaj authored Nov 14, 2024
1 parent 74ae656 commit e9b3a6b
Show file tree
Hide file tree
Showing 60 changed files with 5,088 additions and 7,410 deletions.
7 changes: 7 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"include": ["src/*.js"],
"exclude": ["**/*.spec.js"],
"reporter": ["lcov", "text"],
"all": false,
"cache": true
}
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

132 changes: 0 additions & 132 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ All you need to work with this project is a supported version of [Node.js](https

### Developing

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

### Testing

Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Summary
### Summary

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"pull_request": {
"user": {
"login": "dependabot"
},
"title": "Bump actions/checkout from 3 to 4",
"html_url": "https://github.com/slackapi/slack-github-action/pull/238"
},
"repository": {
"full_name": "slackapi/slack-github-action"
},
"sender": {
"login": "dependabot"
}
}
7 changes: 7 additions & 0 deletions .github/resources/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Move this file to .env before starting

# https://api.slack.com/apps/A0123456789
export SLACK_BOT_TOKEN=xoxb-01010101-example
export SLACK_CHANNEL_ID=C0123456789
export SLACK_INCOMING_WEBHOOK=https://hooks.slack.com/services/T0123456789/B0123456789/abcdefghijklmnopqrstuvwxyz
export SLACK_WEBHOOK_TRIGGER=https://hooks.slack.com/triggers/T0123456789/00000000000/abcdefghijklmnopqrstuvwxyz
6 changes: 6 additions & 0 deletions .github/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Application values
.env.*
.env
!.env.example
.slack/apps.json
.slack/apps.*.json
5 changes: 5 additions & 0 deletions .github/resources/.slack/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"experiments": ["bolt"],
"project_id": "c4805b41-d1ce-4ea0-b297-ed2f8c64c267"
}

35 changes: 35 additions & 0 deletions .github/resources/.slack/incoming-webhook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"text": ":email: A GitHub Action `${{ github.eventName }}` event status is ${{ env.JOB_STATUS }}",
"attachments": [
{
"color": "${{ env.ATTACHMENT_COLOR }}",
"fields": [
{
"title": "Repository",
"short": false,
"value": "<${{ github.payload.repository.html_url }}|${{ github.payload.repository.full_name }}>"
},
{
"title": "Ref",
"short": false,
"value": "${{ github.ref }}"
},
{
"title": "Commit",
"short": false,
"value": "<${{ github.payload.repository.html_url }}/commit/${{ github.sha }}|${{ github.sha }}>"
},
{
"title": "Author",
"short": false,
"value": "<https://github.com/${{ github.actor }}|${{ github.actor }}>"
},
{
"title": "Workflow",
"short": false,
"value": "<${{ github.payload.repository.html_url }}/actions/runs/${{ github.runId }}|${{ github.workflow }}>"
}
]
}
]
}
71 changes: 71 additions & 0 deletions .github/resources/.slack/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"_metadata": {
"major_version": 2
},
"display_information": {
"name": "slacktion",
"description": "an application for developing the Slack GitHub Action"
},
"features": {
"app_home": {
"messages_tab_enabled": true,
"messages_tab_read_only_enabled": true
},
"bot_user": {
"display_name": "slacktion"
}
},
"oauth_config": {
"scopes": {
"bot": [
"chat:write",
"chat:write.public",
"files:write",
"incoming-webhook",
"reactions:write"
]
}
},
"settings": {
"org_deploy_enabled": true,
"incoming_webhooks": {
"incoming_webhooks_enabled": true
}
},
"workflows": {
"event_notifications": {
"title": "GitHub event notifications",
"description": "A new changeset has been discovered",
"input_parameters": {
"properties": {
"author": {
"type": "string"
},
"channel_id": {
"type": "slack#/types/channel_id"
},
"repo_name": {
"type": "string"
},
"status": {
"type": "string"
},
"event_url": {
"type": "string"
}
},
"required": ["author", "channel_id", "repo_name", "status", "event_url"]
},
"steps": [
{
"id": "0",
"function_id": "slack#/functions/send_message",
"inputs": {
"channel_id": "{{inputs.channel_id}}",
"message": ":ship: {{inputs.repo_name}}(@{{inputs.author}}): `{{inputs.status}}` <{{inputs.event_url}}|Check it out here>!"
}
}
]
}
}
}
23 changes: 23 additions & 0 deletions .github/resources/.slack/webhook-trigger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"type": "webhook",
"name": "Post the latest actions from GitHub",
"description": "Share event information to a channel",
"workflow": "#/workflows/event_notifications",
"inputs": {
"author": {
"value": "{{data.author}}"
},
"channel_id": {
"value": "{{data.channel_id}}"
},
"repo_name": {
"value": "{{data.repo_name}}"
},
"status": {
"value": "{{data.status}}"
},
"event_url": {
"value": "{{data.event_url}}"
}
}
}
Loading

0 comments on commit e9b3a6b

Please sign in to comment.