Skip to content

Commit 328320a

Browse files
authored
🎨 Add early exit if there was no successful merge (#265)
* 🎨 Add early exit if there was no successful merge * 🔖 Create new version * 👷 Using new credentials * 🚀 Update dist folder
1 parent f2462c1 commit 328320a

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Execute Action
3838
uses: ./
3939
with:
40-
token: ${{ secrets.DEV_PUSH_TOKEN }}
40+
token: ${{ secrets.GITHUB_TOKEN }}
4141
user: ${{ secrets.DEV_PUSH_USER }}
4242
labels: true
4343
comments: true

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fetch-depth: 0
2929

3030
- name: Autodev
31-
uses: Staffbase/[email protected].1
31+
uses: Staffbase/[email protected].2
3232
with:
3333
# The token used to fetch the pull requests from the GitHub API
3434
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
@@ -59,7 +59,7 @@ Always create the dev branch.
5959

6060
```yaml
6161
- name: Autodev
62-
uses: Staffbase/[email protected].1
62+
uses: Staffbase/[email protected].2
6363
with:
6464
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
6565
```
@@ -68,7 +68,7 @@ Add a status comment if the merge was successful or failed.
6868

6969
```yaml
7070
- name: Autodev
71-
uses: Staffbase/[email protected].1
71+
uses: Staffbase/[email protected].2
7272
with:
7373
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
7474
comments: true
@@ -80,7 +80,7 @@ Add a status label if the merge was successful or failed.
8080

8181
```yaml
8282
- name: Autodev
83-
uses: Staffbase/[email protected].1
83+
uses: Staffbase/[email protected].2
8484
with:
8585
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
8686
labels: true

dist/index.js

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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": "autodev-action",
3-
"version": "v1.8.1",
3+
"version": "v1.8.2",
44
"description": "Github Action that tries to merge all commits from a PR with the dev label into the dev branch.",
55
"main": "lib/index.js",
66
"scripts": {

src/autodev.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ const merge = async (
162162
failed.push(pull)
163163
}
164164
}
165-
await exec(`git reset origin/${base}`)
166-
await exec('git add -A')
167165

168166
const overrideDate = {
169167
env: {
@@ -183,6 +181,13 @@ const merge = async (
183181
`The following branches have been merged:\n${successList}\n\n` +
184182
`The following branches failed to merge:\n${failList}`
185183

184+
if (success.length === 0) {
185+
return message
186+
}
187+
188+
await exec(`git reset origin/${base}`)
189+
await exec('git add -A')
190+
186191
await exec('git commit -m', [message], overrideDate)
187192
// replace with graft commit so we can preserve commit parents
188193
await exec(
@@ -192,8 +197,10 @@ const merge = async (
192197
)
193198
const rev = await execAndSlurp('git rev-parse HEAD')
194199
await exec(`git checkout replace/${rev}`)
200+
195201
await comment(success)
196202
await label(success)
203+
197204
return message
198205
}
199206

0 commit comments

Comments
 (0)