- Introduced `updateRepoInfo` method in the `Repo` class to allow updating repository information such as description, license, site, and topics. - Updated test cases to demonstrate the usage of the new `updateRepoInfo` method. - Modified build script to include a configuration for triggering builds with specific events and environment variables. - Commented out previous repository list fetching code in tests for clarity.
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { Build } from "../src/index.ts";
|
|
|
|
import { token, showMore, cookie } from "./common.ts";
|
|
// group: "kevisual",
|
|
const repo = new Build({ token: token, cookie: cookie });
|
|
|
|
const main = async () => {
|
|
const build = await repo.startBuild('kevisual/cnb', {
|
|
branch: 'main',
|
|
env: {
|
|
},
|
|
event: 'api_trigger_sync_to_gitea',
|
|
config: ``,
|
|
});
|
|
console.log("build", build);
|
|
}
|
|
|
|
// main()
|
|
|
|
const buildByConfig = async () => {
|
|
const build = await repo.startBuild('kevisual/cnb', {
|
|
branch: 'main',
|
|
env: {
|
|
},
|
|
event: 'api_trigger_sync_to_gitea',
|
|
config: config,
|
|
});
|
|
console.log("build", showMore(build));
|
|
}
|
|
|
|
const config = `
|
|
# .cnb.yml
|
|
include:
|
|
- https://cnb.cool/kevisual/cnb/-/blob/main/.cnb/template.yml
|
|
|
|
.common_env: &common_env
|
|
env:
|
|
TO_REPO: kevisual/cnb
|
|
TO_URL: git.xiongxiao.me
|
|
imports:
|
|
- https://cnb.cool/kevisual/env/-/blob/main/.env.development
|
|
|
|
.common_sync_to_gitea: &common_sync_to_gitea
|
|
- <<: *common_env
|
|
services: !reference [.common_sync_to_gitea_template, services]
|
|
stages: !reference [.common_sync_to_gitea_template, stages]
|
|
|
|
.common_sync_from_gitea: &common_sync_from_gitea
|
|
- <<: *common_env
|
|
services: !reference [.common_sync_from_gitea_template, services]
|
|
stages: !reference [.common_sync_from_gitea_template, stages]
|
|
|
|
main:
|
|
web_trigger_sync_to_gitea:
|
|
- <<: *common_sync_to_gitea
|
|
web_trigger_sync_from_gitea:
|
|
- <<: *common_sync_from_gitea
|
|
api_trigger_sync_to_gitea:
|
|
- <<: *common_sync_to_gitea
|
|
api_trigger_sync_from_gitea:
|
|
- <<: *common_sync_from_gitea
|
|
`
|
|
buildByConfig() |