You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support set status commit on push event (#307)
* feat: support push events
* no-release: added workflow to test new feature
* fix: pushed release version and fixed lint
* fix: updated dependencies
* fix: removed actions added to test the action
* fix: use same name to set status
Copy file name to clipboardExpand all lines: README.md
+72-17Lines changed: 72 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,14 @@
5
5
6
6
## Overview
7
7
8
-
A simple Github Action that allows us to update the status of the last commit in a pull request.
8
+
A simple Github Action that allows us to update the status of a commit.
9
9
10
10
GitHub does not update the status of a commit when running workflow and therefore tools that rely on the context/status of a given commit are not compatible with it.
11
11
12
+
Currently the action supports `pull_request` and `push` events:
13
+
* When the event is `pull_request`, the action will set the status to the last commit in the pull request at the moment the workflow was triggered.
14
+
* When the event is `push`, the action will set the status to the last commit pushed at the moment the workflow was triggered.
15
+
12
16
## Input Parameters
13
17
14
18
* token: Auth token used to add status commits
@@ -22,7 +26,7 @@ GitHub does not update the status of a commit when running workflow and therefor
22
26
23
27
* status: Commit or job status, based on this the action will set the correct status in the commit: Accepted values are: `error`, `failure`, `pending`, `success` and `cancelled`.
24
28
25
-
If the passed status is `pending` it wil set status commit `pending`.
29
+
If the passed status is `pending` it will set status commit `pending`.
26
30
27
31
If the passed status is `failure` or `cancelled` it will set status commit `failure`.
28
32
@@ -43,34 +47,85 @@ GitHub does not update the status of a commit when running workflow and therefor
43
47
* optional
44
48
* default: ""
45
49
46
-
* ignoreForks: If the pull request is from a fork the action won't add a status by default. This is because the action won't have a token with permissions to add the status to the commit. You can disable this, but then you'll have to provide a token with enough permissions to add status to the commits in the forks!
50
+
* ignoreForks: If the pull request is from a fork the action won't add a status by default. This is because the action won't have a token with permissions to add the status to the commit. You can disable this, but then you'll have to provide a token with enough permissions to add status to the commits in the forks!__Will be used only for pull requests.__
47
51
48
52
* optional
49
53
* default: "true"
50
54
51
-
* addHoldComment: If true the action will add a comment to the pull request. This is useful if you use prow, since prow won't detect the github actions, so you can use `/hold` and `/hold cancel` to avoid merging the PR before you want. __Important: this will be disabled for forks if `ignoreForks` is set to true, this is because the default github token won't have permissions to add comments if your PR comes from a fork__
55
+
* addHoldComment: If true the action will add a comment to the pull request. This is useful if you use prow, since prow won't detect the github actions, so you can use `/hold` and `/hold cancel` to avoid merging the PR before you want. __Important: this will be disabled for forks if `ignoreForks` is set to true, this is because the default github token won't have permissions to add comments if your PR comes from a fork. Will be used only for pull requests.__
52
56
53
57
* optional
54
58
* default: "false"
55
59
56
-
* pendingComment: This is the message to add to the pull request when the status is `pending`.
60
+
* pendingComment: This is the message to add to the pull request when the status is `pending`.__Will be used only for pull requests.__
57
61
58
62
* optional
59
63
* default: "/hold"
60
64
61
-
* successComment: This is the message to add to the pull request when the status is `success`.
65
+
* successComment: This is the message to add to the pull request when the status is `success`.__Will be used only for pull requests.__
62
66
63
67
* optional
64
68
* default: "/hold cancel"
65
69
66
-
* failComment: This is the message to add to the pull request when the status is `failure`, `error` or `cancelled`.
70
+
* failComment: This is the message to add to the pull request when the status is `failure`, `error` or `cancelled`.__Will be used only for pull requests.__
67
71
68
72
* optional
69
73
* default: "/hold"
70
74
71
75
## Examples
72
76
73
-
### Action sets commit to pending status without comment
77
+
### Action sets push commit to pending status
78
+
79
+
```
80
+
name: Test
81
+
82
+
on: [push]
83
+
84
+
jobs:
85
+
build:
86
+
runs-on: ubuntu-latest
87
+
steps:
88
+
- uses: actions/checkout@v2
89
+
- uses: ouzi-dev/commit-status-updater@v1.1.0
90
+
```
91
+
92
+
### Action sets push commit to pending status with custom name
93
+
94
+
```
95
+
name: Test
96
+
97
+
on: [push]
98
+
99
+
jobs:
100
+
build:
101
+
runs-on: ubuntu-latest
102
+
steps:
103
+
- uses: actions/checkout@v2
104
+
with:
105
+
name: "name of my status check"
106
+
- uses: ouzi-dev/commit-status-updater@v1.1.0
107
+
```
108
+
109
+
### Action sets push commit to pending status on start, and updates check at the end of the workflow
110
+
111
+
```
112
+
name: Test
113
+
114
+
on: [push]
115
+
116
+
jobs:
117
+
build:
118
+
runs-on: ubuntu-latest
119
+
steps:
120
+
- uses: actions/checkout@v2
121
+
- uses: ouzi-dev/commit-status-updater@v1.1.0
122
+
- if: always()
123
+
uses: ouzi-dev/commit-status-updater@v1.1.0
124
+
with:
125
+
status: "${{ job.status }}"
126
+
```
127
+
128
+
### Action sets pull request commit to pending status without comment
74
129
75
130
```
76
131
name: Test
@@ -82,10 +137,10 @@ jobs:
82
137
runs-on: ubuntu-latest
83
138
steps:
84
139
- uses: actions/checkout@v2
85
-
- uses: ouzi-dev/commit-status-updater@v1.0.4
140
+
- uses: ouzi-dev/commit-status-updater@v1.1.0
86
141
```
87
142
88
-
### Action sets commit to error status without comment
143
+
### Action sets pull request commit to error status without comment
89
144
90
145
```
91
146
name: Test
@@ -97,12 +152,12 @@ jobs:
97
152
runs-on: ubuntu-latest
98
153
steps:
99
154
- uses: actions/checkout@v2
100
-
- uses: ouzi-dev/commit-status-updater@v1.0.4
155
+
- uses: ouzi-dev/commit-status-updater@v1.1.0
101
156
with:
102
157
status: "error"
103
158
```
104
159
105
-
### Action sets commit to pending status with comment, and updates check and adds comment at the end of the workflow
160
+
### Action sets pull request commit to pending status with comment, and updates check and adds comment at the end of the workflow
0 commit comments