Skip to content

Commit

Permalink
Add error handling in case release branch doesn't exist yet (radius-p…
Browse files Browse the repository at this point in the history
…roject#7094)

# Description

Fix release issue:
https://github.com/radius-project/radius/actions/runs/7732739510/job/21083323439

## Type of change

<!--

Please select **one** of the following options that describes your
change and delete the others. Clearly identifying the type of change you
are making will help us review your PR faster, and is used in authoring
release notes.

If you are making a bug fix or functionality change to Radius and do not
have an associated issue link please create one now.

-->
- This pull request is a minor refactor, code cleanup, test improvement,
or other maintenance task and doesn't change the functionality of Radius
(issue link optional).

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: Josh <josh@liveoak.ws>
  • Loading branch information
willdavsmith authored and jhandel committed Feb 1, 2024
1 parent 40fe011 commit 5696535
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,22 @@ jobs:
with:
result-encoding: string
script: |
const { data } = await github.rest.repos.getBranch({
owner: context.repo.owner,
repo: context.repo.repo,
branch: '${{ steps.get-version.outputs.release-branch-name }}',
})
try {
const { data } = await github.rest.repos.getBranch({
owner: context.repo.owner,
repo: context.repo.repo,
branch: '${{ steps.get-version.outputs.release-branch-name }}',
})
if (data.name == '${{ steps.get-version.outputs.release-branch-name }}' && context.ref == 'refs/heads/main' && context.eventName == 'push') {
console.log("Release branch ${{ steps.get-version.outputs.release-branch-name }} already exists and this is a push to main.")
return 'true'
} else {
console.log("Release branch ${{ steps.get-version.outputs.release-branch-name }} does not exist or this is not a push to main.")
if (data && data.name == '${{ steps.get-version.outputs.release-branch-name }}' && context.ref == 'refs/heads/main' && context.eventName == 'push') {
console.log("Release branch ${{ steps.get-version.outputs.release-branch-name }} already exists and this is a push to main.")
return 'true'
} else {
console.log("This is not a push to main.")
return 'false'
}
} catch (error) {
console.log("Release branch ${{ steps.get-version.outputs.release-branch-name }} does not exist.")
return 'false'
}
- name: Generate release summary
Expand Down

0 comments on commit 5696535

Please sign in to comment.