Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve the bug of new package version not exist #12

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15666,9 +15666,20 @@ async function run() {

const currentVersionURL = `https://raw.githubusercontent.com/${github.context.repo.owner}/${github.context.repo.repo}/${baseSHA}${workingDirectory}version`;
core.info(`current version url: ${currentVersionURL}`);
let { data: currentVersion } = await axios.get(currentVersionURL, {
headers,
});
let { data: currentVersion } = await axios
.get(currentVersionURL, {
headers,
})
.catch((error) => {
// if status code 404, old version file is not exist, setup version to 0.0.0
if (error.response && error.response.status === 404) {
return {
data: '0.0.0',
};
}
throw error;
});

currentVersion = currentVersion.toString().trim();

const nextVersionURL = `https://raw.githubusercontent.com/${github.context.repo.owner}/${github.context.repo.repo}/${headSHA}${workingDirectory}version`;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "action-version-check",
"version": "0.0.3",
"version": "0.0.4",
"description": "Check if the current version is compliant with the specification",
"main": "index.js",
"scripts": {
Expand Down
17 changes: 14 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,20 @@ async function run() {

const currentVersionURL = `https://raw.githubusercontent.com/${github.context.repo.owner}/${github.context.repo.repo}/${baseSHA}${workingDirectory}version`;
core.info(`current version url: ${currentVersionURL}`);
let { data: currentVersion } = await axios.get(currentVersionURL, {
headers,
});
let { data: currentVersion } = await axios
.get(currentVersionURL, {
headers,
})
.catch((error) => {
// if status code 404, old version file is not exist, setup version to 0.0.0
if (error.response && error.response.status === 404) {
return {
data: '0.0.0',
};
}
throw error;
});

currentVersion = currentVersion.toString().trim();

const nextVersionURL = `https://raw.githubusercontent.com/${github.context.repo.owner}/${github.context.repo.repo}/${headSHA}${workingDirectory}version`;
Expand Down
Loading