Skip to content

Commit b3bcd19

Browse files
committed
updated github action to check for release
1 parent 13d3f4b commit b3bcd19

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/build-deploy.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,25 @@ jobs:
4848
name: commit-extension-${{ github.event.inputs.tag }}
4949
path: ./
5050

51-
# Check if the release already exists
51+
# Check if the tag already exists
5252
- name: Check if release exists
5353
id: check_release
54-
uses: softprops/action-gh-release@v1
54+
uses: actions/github-script@v5
5555
with:
56-
tag_name: ${{ github.event.inputs.tag }}
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
script: |
58+
const release = await github.repos.getReleaseByTag({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
tag: context.ref.replace('refs/tags/', '')
62+
}).catch(err => {
63+
if (err.status === 404) {
64+
return null;
65+
}
66+
throw err;
67+
});
68+
console.log('Release exists: ' + (release !== null));
69+
return release ? { exists: 'true' } : { exists: 'false' };
5970
6071
# Upload the VSIX file to the Github release
6172
- name: Create Release

0 commit comments

Comments
 (0)