Skip to content

Commit

Permalink
Merge pull request #4 from Senzing/issue-1.bryan-nice
Browse files Browse the repository at this point in the history
updated readme to follow standards and updated template yaml to refle…
  • Loading branch information
docktermj authored Jan 15, 2020
2 parents d9b6469 + b046f3a commit ddf30a7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 173 deletions.
186 changes: 24 additions & 162 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Git Action Slack Notification

Git Action to send messages to Slack. This action can be used to send message about the status of a Git Action workflow.
Git Action to send messages to Slack. This action can be used to send message about the status of a Git Action workflow.

## Usage
## Usage

This action can be used after any other action. Below is simple example on using it:

Expand All @@ -23,178 +23,40 @@ jobs:
uses: senzing/git-action-slack-notification@1.0.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: 'Slack Notification Demo'
SLACK_MESSAGE: 'Demo''ing the Slack Notification'
SLACK_TITLE: Slack Notification Demo
SLACK_MESSAGE: Demo'ing the Slack Notification
```
Go [here](deployment/git-actions/template_git_action_slack_notification.yml) for a template yml with all environment variables.
3\. Generate Slack WebHook [here](https://entelexeia.slack.com/apps/A0F7XDUAZ-incoming-webhooks?next_id=0)
4\. Encrypt Slack Webhook as a secret in the repo using this app.
4\. Encrypt Slack Webhook as a secret in the repo using this app.
## Environment Variables
These are the environment variables that can be set to pass in additional information about the Git Action.
<table>
<tr>
<td>
Variable Name
</td>
<td>
Required
</td>
<td>
Description
</td>
</tr>
<tr>
<td>
SLACK_WEBHOOK
</td>
<td>
Yes
</td>
<td>
The Webhook URL generated by Slack to send messages too.
</td>
</tr>
<tr>
<td>
SLACK_TITLE
</td>
<td>
Yes
</td>
<td>
Title of the Slack message being sent.
</td>
</tr>
<tr>
<td>
SLACK_MESSAGE
</td>
<td>
Yes
</td>
<td>
The message payload to be sent to Slack
</td>
</tr>
<tr>
<td>
SLACK_ICON
</td>
<td>
No
</td>
<td>
The Slack user icon to use instead of the default
</td>
</tr>
<tr>
<td>
SLACK_CHANNEL
</td>
<td>
No
</td>
<td>
The Slack channel to use instead of the default
</td>
</tr>
<tr>
<td>
SLACK_COLOR
</td>
<td>
No
</td>
<td>
Format color to use for the Slack message
</td>
</tr>
<tr>
<td>
SLACK_USERNAME
</td>
<td>
No
</td>
<td>
The Slack username to use instead of the default
</td>
</tr>
<tr>
<td>
GITHUB_ACTOR
</td>
<td>
No
</td>
<td>
GitHub Actor variable passed from Git Actions
</td>
</tr>
<tr>
<td>
GITHUB_REPOSITORY
</td>
<td>
No
</td>
<td>
GitHub Repository variable passed from Git Actions
</td>
</tr>
<tr>
<td>
GITHUB_REF
</td>
<td>
No
</td>
<td>
GitHub reference variable passed from Git Actions
</td>
</tr>
<tr>
<td>
GITHUB_ACTION
</td>
<td>
No
</td>
<td>
GitHub Action name variable passed from Git Actions
</td>
</tr>
<tr>
<td>
GITHUB_EVENT_NAME
</td>
<td>
No
</td>
<td>
GitHub Action event name variable passed from Git Actions
</td>
</tr>
<tr>
<td>
GITHUB_WORKFLOW
</td>
<td>
No
</td>
<td>
GitHub Action workflow varaible passed from Git Actions
</td>
</tr>
</table>
| Variable Name | Required | Description |
|--------------------|:--------:|-------------|
| GITHUB_ACTION | No | GitHub Action name variable passed from Git Actions |
| GITHUB_ACTOR | No | GitHub Actor variable passed from Git Actions |
| GITHUB_EVENT_NAME | No | GitHub Action event name variable passed from Git Actions |
| GITHUB_REF | No | GitHub reference variable passed from Git Actions |
| GITHUB_REPOSITORY | No | GitHub Repository variable passed from Git Actions |
| GITHUB_WORKFLOW | No | GitHub Action workflow varaible passed from Git Actions |
| SLACK_CHANNEL | No | The Slack channel to use instead of the default |
| SLACK_COLOR | No | Format color to use for the Slack message |
| SLACK_ICON | No | The Slack user icon to use instead of the default |
| SLACK_MESSAGE | Yes | The message payload to be sent to Slack|
| SLACK_TITLE | Yes | Title of the Slack message being sent. |
| SLACK_USERNAME | No | The Slack username to use instead of the default |
| SLACK_WEBHOOK | Yes | The Webhook URL generated by Slack to send messages too. |
## Reference
* [Using environment variables](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables) lists the default environment variables set in Git Actions.
## License
[Apache 2](LICENSE)
[Apache 2](LICENSE)
22 changes: 11 additions & 11 deletions deployment/git-actions/template_git_action_slack_notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
- name: Slack Notification Demo
uses: senzing/git-action-slack-notification@1.0.0
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: 'Slack Notification Demo'
SLACK_MESSAGE: 'Demo''ing the Slack Notification'
SLACK_ICON: 'https://github.com/<Github User>.png?size=48'
SLACK_CHANNEL: 'demo-channel'
SLACK_COLOR: '#efefef'
SLACK_USERNAME: 'demo-bot'
GITHUB_ACTOR: ${GITHUB_ACTOR}
GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}
GITHUB_REF: ${GITHUB_REF}
GITHUB_ACTION: ${GITHUB_ACTION}
GITHUB_ACTOR: ${GITHUB_ACTOR}
GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}
GITHUB_WORKFLOW: ${GITHUB_WORKFLOW}
GITHUB_REF: ${GITHUB_REF}
GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}
GITHUB_WORKFLOW: ${GITHUB_WORKFLOW}
SLACK_CHANNEL: demo-channel
SLACK_COLOR: '#efefef'
SLACK_ICON: https://github.com/<Github User>.png?size=48
SLACK_MESSAGE: Demo'ing the Slack Notification
SLACK_TITLE: Slack Notification Demo
SLACK_USERNAME: demo-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 comments on commit ddf30a7

Please sign in to comment.