Skip to content

Commit

Permalink
🎨 Add early exit if there was no successful merge (#265)
Browse files Browse the repository at this point in the history
* 🎨 Add early exit if there was no successful merge

* 🔖 Create new version

* 👷 Using new credentials

* 🚀 Update dist folder
  • Loading branch information
flaxel committed Aug 23, 2023
1 parent f2462c1 commit 328320a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Execute Action
uses: ./
with:
token: ${{ secrets.DEV_PUSH_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
user: ${{ secrets.DEV_PUSH_USER }}
labels: true
comments: true
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fetch-depth: 0

- name: Autodev
uses: Staffbase/autodev-action@v1.8.1
uses: Staffbase/autodev-action@v1.8.2
with:
# The token used to fetch the pull requests from the GitHub API
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
Expand Down Expand Up @@ -59,7 +59,7 @@ Always create the dev branch.

```yaml
- name: Autodev
uses: Staffbase/autodev-action@v1.8.1
uses: Staffbase/autodev-action@v1.8.2
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
```
Expand All @@ -68,7 +68,7 @@ Add a status comment if the merge was successful or failed.

```yaml
- name: Autodev
uses: Staffbase/autodev-action@v1.8.1
uses: Staffbase/autodev-action@v1.8.2
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
comments: true
Expand All @@ -80,7 +80,7 @@ Add a status label if the merge was successful or failed.

```yaml
- name: Autodev
uses: Staffbase/autodev-action@v1.8.1
uses: Staffbase/autodev-action@v1.8.2
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
labels: true
Expand Down
17 changes: 11 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "autodev-action",
"version": "v1.8.1",
"version": "v1.8.2",
"description": "Github Action that tries to merge all commits from a PR with the dev label into the dev branch.",
"main": "lib/index.js",
"scripts": {
Expand Down
11 changes: 9 additions & 2 deletions src/autodev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ const merge = async (
failed.push(pull)
}
}
await exec(`git reset origin/${base}`)
await exec('git add -A')

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

if (success.length === 0) {
return message
}

await exec(`git reset origin/${base}`)
await exec('git add -A')

await exec('git commit -m', [message], overrideDate)
// replace with graft commit so we can preserve commit parents
await exec(
Expand All @@ -192,8 +197,10 @@ const merge = async (
)
const rev = await execAndSlurp('git rev-parse HEAD')
await exec(`git checkout replace/${rev}`)

await comment(success)
await label(success)

return message
}

Expand Down

0 comments on commit 328320a

Please sign in to comment.