Skip to content

Commit

Permalink
Fix tag gh action script
Browse files Browse the repository at this point in the history
404 status throws errors, we are catching that.
  • Loading branch information
giggio committed Sep 25, 2023
1 parent ce13f36 commit 82a6380
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ jobs:
name: Create tag
with:
script: |
const tag = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ steps.version.outputs.VERSION }}'
});
if (tag != null && tag.status == 200) {
console.error('Tag ${{ steps.version.outputs.VERSION }} already exists.');
return;
try {
const tag = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ steps.version.outputs.VERSION }}'
});
if (tag != null && tag.status == 200) {
console.log('Tag ${{ steps.version.outputs.VERSION }} already exists.');
return;
}
} catch (error) {
if (error.status !== 404) {
console.error('Error when trying to get tag ${{ steps.version.outputs.VERSION }}.');
return;
}
}
const main = await github.rest.git.getRef({
owner: context.repo.owner,
Expand Down

0 comments on commit 82a6380

Please sign in to comment.