Skip to content

Commit

Permalink
workaround for polkadot-sdk stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
girazoki committed Nov 2, 2023
1 parent 30f719e commit 0ee83f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/github/generate-release-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function main() {
const previousTag = argv.from;
const newTag = argv.to;

const moduleLinks = ["polkadot-sdk", "frontier"].map((repoName) => ({
const moduleLinks = ["substrate", "frontier", "cumulus", "frontier"].map((repoName) => ({
name: repoName,
link: getCompareLink(repoName, previousTag, newTag),
}));
Expand Down
14 changes: 12 additions & 2 deletions tools/github/github-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ type Await<T> = T extends PromiseLike<infer U> ? U : T;
type Commits = Await<ReturnType<Octokit["rest"]["repos"]["compareCommits"]>>["data"]["commits"];

export function getCompareLink(packageName: string, previousTag: string, newTag: string) {
console.log(packageName);

const previousPackage = execSync(
`git show ${previousTag}:../Cargo.lock | grep ${packageName}? | head -1 | grep -o '".*"'`
).toString();
const previousCommit = /#([0-9a-f]*)/g.exec(previousPackage)[1].slice(0, 8);
const previousRepo = /(https:\/\/.*)\?/g.exec(previousPackage)[1];

const newPackage = execSync(
// Temporary solution
// TODO: we should pass here only polkadot-sdk after this release
let newPackage;
try { newPackage = execSync(
`git show ${newTag}:../Cargo.lock | grep ${packageName}? | head -1 | grep -o '".*"'`
).toString();
).toString()}
catch {
newPackage = execSync(
`git show ${newTag}:../Cargo.lock | grep polkadot-sdk? | head -1 | grep -o '".*"'`
).toString()
};
const newCommit = /#([0-9a-f]*)/g.exec(newPackage)[1].slice(0, 8);
const newRepo = /(https:\/\/.*)\?/g.exec(newPackage)[1];
const newRepoOrganization = /github.com\/([^\/]*)/g.exec(newRepo)[1];
Expand Down

0 comments on commit 0ee83f4

Please sign in to comment.