-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c9d3fc
commit 4a6d29a
Showing
10 changed files
with
640 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,15 @@ | ||
import type { TriggerContext } from './trigger' | ||
import { info } from '@actions/core' | ||
import { addContributor, getPrData } from '../utils' | ||
|
||
const vuePackageUrl = 'https://raw.githubusercontent.com/Tencent/tdesign-icons/refs/heads/develop/packages/vue/package.json' | ||
const vueNextPackageUrl = 'https://raw.githubusercontent.com/Tencent/tdesign-icons/refs/heads/develop/packages/vue-next/package.json' | ||
const reactPackageUrl = 'https://raw.githubusercontent.com/Tencent/tdesign-icons/refs/heads/develop/packages/react/package.json' | ||
const viewPackageUrl = 'https://raw.githubusercontent.com/Tencent/tdesign-icons/refs/heads/develop/packages/view/package.json' | ||
import { addContributor, cloneRepo, getPkgLatestVersion, getPrData, updateIcons } from '../utils' | ||
import { iconsMap, ownerMap, repoMap, type TriggerContext } from './trigger' | ||
|
||
export default async function start(context: TriggerContext) { | ||
const pr_data = await getPrData(context.owner, context.repo, context.pr_number, context.token) | ||
const body = addContributor(pr_data.body || '', 'tdesign-helper') | ||
|
||
const prData = await getPrData(context.owner, context.repo, context.pr_number, context.token) | ||
const body = addContributor(prData.body || '', prData.user.login) | ||
info(`body:${body}`) | ||
const packageName = iconsMap[context.comment] | ||
cloneRepo(ownerMap[context.comment], repoMap[context.comment], context.token) | ||
updateIcons(packageName) | ||
const latestVersion = await getPkgLatestVersion(packageName) | ||
const title = `chore(Icon): update to ${latestVersion}` | ||
info(title) | ||
}; | ||
|
||
function _vue() { | ||
info(viewPackageUrl) | ||
info(vuePackageUrl) | ||
} | ||
function _vueNext() { | ||
info(vueNextPackageUrl) | ||
} | ||
function _react() { | ||
info(reactPackageUrl) | ||
} | ||
function _mobileVue() { | ||
info(vueNextPackageUrl) | ||
} | ||
function _mobileReact() { | ||
info(reactPackageUrl) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "fixture", | ||
"private": true, | ||
"devDependencies": { | ||
"tdesign-icons-react": "^3.0.0", | ||
"tdesign-icons-view": "^4.0.0", | ||
"tdesign-icons-vue": "^1.0.0", | ||
"tdesign-icons-vue-next": "^2.0.0" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { describe, it, vi } from 'vitest' | ||
import start from '../../src/tdesign/icons' | ||
import pr_data from '../fixtures/tdesign-icons-pr-data.json' with { type: 'json' } | ||
|
||
vi.mock('../../src/utils.ts', async () => { | ||
return { | ||
...(await vi.importActual<typeof import('../../src/utils.ts')>('../../src/utils.ts')), | ||
getPrData: () => pr_data, | ||
getPkgLatestVersion: () => 'x.x.x', | ||
cloneRepo: () => vi.fn(), | ||
} | ||
}) | ||
|
||
describe('tdesign/icons', () => { | ||
describe('comment', () => { | ||
it('/pr-vue', async () => { | ||
const context = { | ||
owner: 'Tencent', | ||
repo: 'tdesign-icons', | ||
pr_number: 1, | ||
comment: '/pr-vue', | ||
token: 'token', | ||
} | ||
start(context) | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters