forked from yardenshoham/gitea-backporter
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add import maps and import standard library from jsr
- Loading branch information
1 parent
f80155a
commit 36c50ce
Showing
11 changed files
with
173 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"imports": { | ||
"@octokit/types": "npm:@octokit/[email protected]", | ||
"@octokit/webhooks": "npm:@octokit/[email protected]", | ||
"@octokit/webhooks-methods": "npm:@octokit/[email protected]", | ||
"@std/async": "jsr:@std/[email protected]", | ||
"@std/http": "jsr:@std/[email protected]", | ||
"@std/semver": "jsr:@std/[email protected]", | ||
"@std/testing": "jsr:@std/[email protected]" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,12 +1,12 @@ | ||
import { SemVer } from "https://deno.land/[email protected]/semver/mod.ts"; | ||
import { parse } from "@std/semver"; | ||
import { getMilestones } from "./github.ts"; | ||
|
||
export class GiteaVersion { | ||
majorMinorVersion: string; | ||
milestoneNumber: number; | ||
|
||
constructor(milestone: { title: string; number: number }) { | ||
const semver = new SemVer(milestone.title); | ||
const semver = parse(milestone.title); | ||
this.majorMinorVersion = `${semver.major}.${semver.minor}`; | ||
this.milestoneNumber = milestone.number; | ||
} | ||
|
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,4 +1,4 @@ | ||
import * as semver from "https://deno.land/[email protected]/semver/mod.ts"; | ||
import { valid, lt, parse } from "@std/semver"; | ||
import { getPrBranchName } from "./git.ts"; | ||
import { GiteaVersion } from "./giteaVersion.ts"; | ||
import { backportPrExistsCache } from "./state.ts"; | ||
|
@@ -294,17 +294,17 @@ export const getMilestones = async (): Promise<Milestone[]> => { | |
if (!response.ok) throw new Error(await response.text()); | ||
const json = await response.json(); | ||
const milestones: Milestone[] = json.filter((m: Milestone) => | ||
semver.valid(m.title) | ||
valid(m.title) | ||
); | ||
|
||
// take only the earliest patch version of each minor version (e.g. 1.19.0, 1.19.1, 1.19.2 -> 1.19.0) | ||
const earliestPatchVersions: Record<string, Milestone> = {}; | ||
for (const milestone of milestones) { | ||
const version = new semver.SemVer(milestone.title); | ||
const version = parse(milestone.title); | ||
const key = `${version.major}.${version.minor}`; | ||
if ( | ||
!earliestPatchVersions[key] || | ||
semver.lt(milestone.title, earliestPatchVersions[key].title) | ||
lt(milestone.title, earliestPatchVersions[key].title) | ||
) { | ||
earliestPatchVersions[key] = milestone; | ||
} | ||
|
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,7 +1,7 @@ | ||
import { | ||
assertEquals, | ||
assertFalse, | ||
} from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
} from "@std/testing/asserts"; | ||
import { | ||
backportPrExists, | ||
fetchBranch, | ||
|
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ import { | |
removeLabel, | ||
} from "./github.ts"; | ||
import { fetchGiteaVersions } from "./giteaVersion.ts"; | ||
import { debounce } from "https://deno.land/[email protected]/async/mod.ts"; | ||
import { debounce } from "@std/async"; | ||
import type { PullRequest } from "./types.ts"; | ||
|
||
// a relevant label is one that is used to control the merge queue, | ||
|
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,6 +1,6 @@ | ||
import { fetchPendingMerge, removeLabel } from "./github.ts"; | ||
import * as prActions from "./prActions.ts"; | ||
import { debounce } from "https://deno.land/[email protected]/async/mod.ts"; | ||
import { debounce } from "@std/async"; | ||
|
||
const updateBranch = async () => { | ||
// fetch all PRs that are pending merge | ||
|
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,4 +1,4 @@ | ||
import * as SemVer from "https://deno.land/[email protected]/semver/mod.ts"; | ||
import * as SemVer from "@std/semver"; | ||
import { fetchGiteaVersions } from "./giteaVersion.ts"; | ||
import * as github from "./github.ts"; | ||
import type { PullRequest } from "./types.ts"; | ||
|
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,5 +1,5 @@ | ||
import { addComment, needsUpdate, removeLabel, updatePr } from "./github.ts"; | ||
import { debounce } from "https://deno.land/[email protected]/async/mod.ts"; | ||
import { debounce } from "@std/async"; | ||
|
||
const execute = async ( | ||
label: string, | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { serve } from "https://deno.land/[email protected]/http/server.ts"; | ||
import { createEventHandler } from "https://esm.sh/@octokit/webhooks@11.0.0"; | ||
import { verify } from "https://esm.sh/@octokit/webhooks-methods@3.0.2"; | ||
import { serve } from "@std/http"; | ||
import { createEventHandler } from "@octokit/webhooks"; | ||
import { verify } from "@octokit/webhooks-methods"; | ||
import * as backport from "./backport.ts"; | ||
import * as labels from "./labels.ts"; | ||
import * as mergeQueue from "./mergeQueue.ts"; | ||
|