Skip to content

Commit b8cfe7a

Browse files
authored
Merge pull request #557 from fjogeleit/pr-exists-handling
Handle PR exists as info instead failing
2 parents cf2e493 + bd8beb0 commit b8cfe7a

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ jobs:
4949
message: 'Update Image Version to v1.2.0'
5050
token: ${{ secrets.GH_TOKEN }}
5151

52-
5352
test-target-repository:
5453
runs-on: ubuntu-latest
5554
steps:
@@ -84,7 +83,6 @@ jobs:
8483
value: v1.0.1
8584
masterBranchName: main
8685
commitChange: 'false'
87-
updateFile: 'true'
8886
- name: Cat Updated values.yaml
8987
run: cat __tests__/fixtures/values.yaml
9088

src/action.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ export async function run(options: Options, actions: Actions): Promise<void> {
5454
)
5555
}
5656
} catch (error) {
57-
actions.setFailed((error as Error).toString())
58-
return
57+
const msg = (error as Error).toString()
58+
59+
if (msg.includes('pull request already exists')) {
60+
actions.info("Pull Request already exists")
61+
return
62+
}
63+
64+
actions.setFailed(`failed to create PR: ${msg}`)
5965
}
6066
}
6167

src/options.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ export class EnvOptions implements Options {
225225
return process.env.MASTER_BRANCH_NAME || ''
226226
}
227227

228+
get force(): boolean {
229+
return process.env.FORCE === 'true'
230+
}
231+
228232
get commitChange(): boolean {
229233
return process.env.COMMIT_CHANGE === 'true'
230234
}

0 commit comments

Comments
 (0)