Node version upgrade to 20 (#38)

* Node version update to 20

* 1.0.0

* Run Format check

* Formatted changes

* Update package.json

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>

* Update api-utils.ts

---------

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
This commit is contained in:
HarithaVattikuti 2023-12-07 17:41:08 +05:30 committed by GitHub
parent 7ea110f150
commit f784495ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 28603 additions and 12796 deletions

View File

@ -10,3 +10,5 @@ jobs:
call-basic-validation:
name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with:
node-version: '20'

View File

@ -15,3 +15,5 @@ jobs:
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: '20'

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ process.env.GITHUB_REPOSITORY = 'test/repository';
describe('validateIfReleaseIsPublished', () => {
beforeEach(() => {
getReleaseSpy = jest.spyOn(octokitClient.repos, 'getReleaseByTag');
getReleaseSpy = jest.spyOn(octokitClient.rest.repos, 'getReleaseByTag');
});
it('throw if release is marked as pre-release', async () => {

View File

@ -13,5 +13,5 @@ outputs:
major-tag:
description: 'The major version tag that has been updated (created). Examples: v1, 1'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'

32574
dist/index.js vendored

File diff suppressed because one or more lines are too long

8647
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "publish-action",
"version": "0.2.1",
"version": "0.3.0",
"description": "Update the major version tag (v1, v2, etc.) to point to the specified tag",
"main": "lib/main.js",
"scripts": {
@ -27,24 +27,24 @@
"homepage": "https://github.com/actions/publish-action#readme",
"dependencies": {
"@actions/core": "^1.2.7",
"@actions/github": "^4.0.0",
"@actions/http-client": "^1.0.11",
"@actions/github": "^6.0.0",
"@actions/http-client": "^2.2.0",
"semver": "^7.5.2"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/jest": "^29.5.10",
"@types/semver": "^7.3.6",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.28.5",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-node": "^11.1.0",
"jest": "^27.2.5",
"jest-circus": "^27.2.5",
"prettier": "^2.8.4",
"ts-jest": "^27.0.5",
"typescript": "^4.2.4"
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"prettier": "^3.1.0",
"ts-jest": "^29.1.1",
"typescript": "^5.3.2"
}
}

View File

@ -14,19 +14,23 @@ interface GitRef {
};
}
interface ErrorStatus extends Error {
status?: number;
}
async function findTag(
tag: string,
octokitClient: InstanceType<typeof GitHub>
): Promise<GitRef | null> {
try {
const {data: foundTag} = await octokitClient.git.getRef({
const {data: foundTag} = await octokitClient.rest.git.getRef({
...context.repo,
ref: `tags/${tag}`
});
return foundTag;
} catch (err) {
if (err.status === 404) {
if ((err as ErrorStatus).status === 404) {
return null;
} else {
throw new Error(
@ -53,10 +57,12 @@ export async function validateIfReleaseIsPublished(
octokitClient: InstanceType<typeof GitHub>
): Promise<void> {
try {
const {data: foundRelease} = await octokitClient.repos.getReleaseByTag({
const {data: foundRelease} = await octokitClient.rest.repos.getReleaseByTag(
{
...context.repo,
tag
});
}
);
if (foundRelease.prerelease) {
throw new Error(
@ -64,7 +70,7 @@ export async function validateIfReleaseIsPublished(
);
}
} catch (err) {
if (err.status === 404) {
if ((err as ErrorStatus).status === 404) {
throw new Error(`No GitHub release found for the ${tag} tag`);
} else {
throw new Error(
@ -88,7 +94,7 @@ export async function updateTag(
`Updating the '${targetTag}' tag to point to the '${sourceTag}' tag`
);
await octokitClient.git.updateRef({
await octokitClient.rest.git.updateRef({
...context.repo,
ref: refName,
sha: sourceTagSHA,
@ -97,7 +103,7 @@ export async function updateTag(
} else {
core.info(`Creating the '${targetTag}' tag from the '${sourceTag}' tag`);
await octokitClient.git.createRef({
await octokitClient.rest.git.createRef({
...context.repo,
ref: `refs/${refName}`,
sha: sourceTagSHA