init auto release project
This commit is contained in:
@ -10,12 +10,43 @@ async function run() {
|
||||
|
||||
const [owner, repo] = repository.split("/");
|
||||
|
||||
const gitea_client = new gitea.GiteaApi({
|
||||
const client = new gitea.GiteaApi({
|
||||
BASE: `https://${host}/api/v1`,
|
||||
WITH_CREDENTIALS: true,
|
||||
TOKEN: token,
|
||||
});
|
||||
|
||||
let release = await client.repository.repoGetReleaseByTag({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
tag: body.tag_name,
|
||||
});
|
||||
const release_id = release.id;
|
||||
let target_commitish = release.target_commitish;
|
||||
if (
|
||||
body.target_commitish &&
|
||||
body.target_commitish !== release.target_commitish
|
||||
) {
|
||||
console.log(
|
||||
`Updating commit from "${release.target_commitish}" to "${body.target_commitish}"`
|
||||
);
|
||||
}
|
||||
target_commitish = body.target_commitish;
|
||||
release = client.repository.repoEditRelease({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
id: release_id,
|
||||
body: {
|
||||
body: body.body || release.body,
|
||||
draft: body.draft !== undefined ? body.draft : release.draft,
|
||||
name: body.name || release.name,
|
||||
prerelease:
|
||||
body.prerelease !== undefined ? body.prerelease : release.prerelease,
|
||||
tag_name: body.tag_name || release.tag_name,
|
||||
target_commitish: target_commitish,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`TEST ${host} ${token} ${repository} ${owner} ${repo}`);
|
||||
// console.log(`🎉 Release ready at ${response.html_url}`);
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user