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

refactor: replace @unlike/github-actions-core with @actions/core #341

Merged
merged 3 commits into from
Apr 21, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/perfect-worms-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"github-actions-cloudflare-pages": minor
---

refactor: replace [@unlike/github-actions-core](https://www.npmjs.com/package/@unlike/github-actions-core) with [@actions/core](https://www.npmjs.com/package/@actions/core) . It increases the bundle size from 30.6kb to 600.5kb because of [actions/toolkit#1436](https://github.com/actions/toolkit/issues/1436) & [actions/toolkit#1697](https://github.com/actions/toolkit/issues/1697). But we no longer want to maintain the fork of that repo. Rather they fix these issues.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as core from '@unlike/github-actions-core'
import * as core from '@actions/core'
import {vi} from 'vitest'

export const getInput = vi.fn<
Expand Down
4 changes: 2 additions & 2 deletions __tests__/common/batch-delete.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as core from '@unlike/github-actions-core'
import * as core from '@actions/core'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import {DeploymentState, DeploymentStatusState} from '@/gql/graphql.js'
Expand All @@ -20,7 +20,7 @@ import {
setMockApi
} from '../helpers/api.js'

vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
describe('batch-delete', () => {
let mockApi: MockApi

Expand Down
4 changes: 2 additions & 2 deletions __tests__/common/cloudflare/api/fetch-error.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as core from '@unlike/github-actions-core'
import * as core from '@actions/core'
import {describe, expect, test, vi} from 'vitest'

import type {FetchResult} from '@/common/cloudflare/types.js'
Expand All @@ -7,7 +7,7 @@ import {throwFetchError} from '@/common/cloudflare/api/fetch-error.js'

const RESOURCE_URL = `https://api.cloudflare.com/path`

vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
describe('throwFetchError', () => {
test('throws parsed error with notes', () => {
expect.assertions(3)
Expand Down
4 changes: 2 additions & 2 deletions __tests__/common/cloudflare/api/fetch-result.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {error} from '@unlike/github-actions-core'
import {error} from '@actions/core'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import type {MockApi} from '@/tests/helpers/api.js'
Expand All @@ -14,7 +14,7 @@ const RESOURCE_URL_DOMAIN = `https://api.cloudflare.com`
const RESOURCE_URL_PATH = `/client/v4/accounts`
const RESOURCE_URL = `${RESOURCE_URL_DOMAIN}${RESOURCE_URL_PATH}`

vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
describe('api', () => {
describe('fetchResult', () => {
let mockApi: MockApi
Expand Down
4 changes: 2 additions & 2 deletions __tests__/common/cloudflare/deployment/create.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {info, setOutput, summary} from '@unlike/github-actions-core'
import {info, setOutput, summary} from '@actions/core'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import type {MockApi} from '@/tests/helpers/api.js'
Expand All @@ -18,7 +18,7 @@ import {execAsync} from '@/common/utils.js'
import {INPUT_KEY_WORKING_DIRECTORY} from '@/input-keys'

vi.mock('@/common/utils.js')
vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
describe('createCloudflareDeployment', () => {
describe('api calls', () => {
let mockApi: MockApi
Expand Down
2 changes: 1 addition & 1 deletion __tests__/common/github/comment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {WorkflowEventExtract} from '@/common/github/workflow-event/types.js
import {addComment, MutationAddComment} from '@/common/github/comment.js'
import * as Context from '@/common/github/context.js'

vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
describe('addComment', () => {
const mockData = RESPONSE_DEPLOYMENTS.result[0] as unknown as PagesDeployment
let mockApi: MockApi
Expand Down
4 changes: 2 additions & 2 deletions __tests__/common/github/environment.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {error, notice, setFailed} from '@unlike/github-actions-core'
import {error, notice, setFailed} from '@actions/core'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import type {GetEnvironmentQuery} from '@/gql/graphql.js'
Expand All @@ -16,7 +16,7 @@ import {
QueryGetEnvironment
} from '@/common/github/environment.js'

vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
describe('environment', () => {
let mockApi: MockApi

Expand Down
4 changes: 2 additions & 2 deletions __tests__/deploy/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {setOutput} from '@unlike/github-actions-core'
import {setOutput} from '@actions/core'
import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'

import type {MockApi} from '@/tests/helpers/api.js'
Expand All @@ -14,7 +14,7 @@ import {execAsync} from '@/common/utils.js'
// import RESPONSE_PROJECT from '@/responses/api.cloudflare.com/pages/projects/project.response.json'
import {run} from '@/deploy/main.js'

vi.mock('@unlike/github-actions-core')
vi.mock('@actions/core')
vi.mock('@/common/utils.js')
vi.mock('@/common/github/environment.js')
vi.mock('@/common/github/deployment/create.js')
Expand Down
73 changes: 65 additions & 8 deletions dist/delete/index.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dist/delete/index.js.LEGAL.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dist/delete/index.js.map

Large diffs are not rendered by default.

69 changes: 63 additions & 6 deletions dist/deploy/index.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions dist/deploy/index.js.LEGAL.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dist/deploy/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"version": "changeset version"
},
"dependencies": {
"@actions/core": "1.10.1",
"@octokit-next/core": "2.8.0",
"@octokit/plugin-paginate-rest": "11.1.1",
"@unlike/github-actions-core": "1.1.2",
"wrangler": "3.51.2"
},
"devDependencies": {
Expand Down