Skip to content

Commit ceac6a0

Browse files
authored
Add commit push event (#5)
Adds support for normal commit pushes to a branch
1 parent 900da3e commit ceac6a0

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
push:
1010
tags:
1111
- '*'
12+
branches:
13+
- '*'
1214

1315
jobs:
1416
test:

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We currently support:
1010

1111
- `pull_request`
1212
- `release`
13-
- `push` (tags)
13+
- `push` (tags, commits)
1414

1515
## Messages
1616

@@ -51,6 +51,13 @@ All event messages will have these elements:
5151
1. Commit Hash - Also a link showing all changes since this tag and master
5252
2. Tag name - Also a link to the tag
5353

54+
### Commits
55+
56+
![Commits](https://user-images.githubusercontent.com/5962998/85979786-1fabf580-b9af-11ea-88f7-1d71a08e14ee.png)
57+
58+
1. Commit Hash - Also a link showing combined changes of all commits for the push
59+
2. Head Commit name - Name of last commit in the batch (can push multiple commits). Also a link to that commit.
60+
5461
## Usage
5562

5663
You can use this action after any other action, however I recommend you put it as the last one. Here is an example setup of this action for a pull request:
@@ -76,7 +83,7 @@ jobs:
7683
- run: npm install
7784
- run: npm test
7885

79-
- uses: iRoachie/slack-github-actions@v1.0.0
86+
- uses: iRoachie/slack-github-actions@v1.1.0
8087
env:
8188
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
8289
with:
@@ -111,7 +118,7 @@ jobs:
111118
- uses: actions/checkout@v2
112119
- run: yarn
113120
- run: yarn test
114-
- uses: iRoachie/slack-github-actions@v1.0.0
121+
- uses: iRoachie/slack-github-actions@v1.1.0
115122
env:
116123
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
117124
with:
@@ -125,7 +132,7 @@ jobs:
125132
- uses: actions/checkout@v2
126133
- run: yarn
127134
- run: yarn lint
128-
- uses: iRoachie/slack-github-actions@v1.0.0
135+
- uses: iRoachie/slack-github-actions@v1.1.0
129136
env:
130137
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
131138
with:
@@ -137,7 +144,7 @@ jobs:
137144
needs: [test, lint]
138145
runs-on: ubuntu-latest
139146
steps:
140-
- uses: iRoachie/slack-github-actions@v1.0.0
147+
- uses: iRoachie/slack-github-actions@v1.1.0
141148
env:
142149
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
143150
with:

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21666,7 +21666,7 @@ const getMessage = () => {
2166621666
return `Workflow <${runUrl}|${process.env.GITHUB_WORKFLOW}> (<${tag.commit}|${commitId}>) for Tag <${tag.url}| ${tag.title}>`;
2166721667
}
2166821668

21669-
return null;
21669+
return `Workflow <${runUrl}|${process.env.GITHUB_WORKFLOW}> (<${github_1.payload.compare}|${commitId}>) for Commit <${github_1.payload.head_commit.url}| ${github_1.payload.head_commit.message}>`;
2167021670
}
2167121671

2167221672
default:

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slack-github-action",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"source": "src/index.ts",
55
"main": "dist/index.js",
66
"repository": "https://github.com/iRoachie/slack-github-action.git",

src/notify.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ const getMessage = () => {
7171
return `Workflow <${runUrl}|${process.env.GITHUB_WORKFLOW}> (<${tag.commit}|${commitId}>) for Tag <${tag.url}| ${tag.title}>`;
7272
}
7373

74-
return null;
74+
// Normal commit push
75+
return `Workflow <${runUrl}|${process.env.GITHUB_WORKFLOW}> (<${context.payload.compare}|${commitId}>) for Commit <${context.payload.head_commit.url}| ${context.payload.head_commit.message}>`;
7576
}
7677

7778
default:

0 commit comments

Comments
 (0)