Skip to content

Commit

Permalink
Merge pull request #557 from fjogeleit/pr-exists-handling
Browse files Browse the repository at this point in the history
Handle PR exists as info instead failing
  • Loading branch information
fjogeleit authored Jan 25, 2024
2 parents cf2e493 + bd8beb0 commit b8cfe7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
message: 'Update Image Version to v1.2.0'
token: ${{ secrets.GH_TOKEN }}


test-target-repository:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -84,7 +83,6 @@ jobs:
value: v1.0.1
masterBranchName: main
commitChange: 'false'
updateFile: 'true'
- name: Cat Updated values.yaml
run: cat __tests__/fixtures/values.yaml

Expand Down
10 changes: 8 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ export async function run(options: Options, actions: Actions): Promise<void> {
)
}
} catch (error) {
actions.setFailed((error as Error).toString())
return
const msg = (error as Error).toString()

if (msg.includes('pull request already exists')) {
actions.info("Pull Request already exists")
return
}

actions.setFailed(`failed to create PR: ${msg}`)
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ export class EnvOptions implements Options {
return process.env.MASTER_BRANCH_NAME || ''
}

get force(): boolean {
return process.env.FORCE === 'true'
}

get commitChange(): boolean {
return process.env.COMMIT_CHANGE === 'true'
}
Expand Down

0 comments on commit b8cfe7a

Please sign in to comment.