Skip to content

release script #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"axios": "^1.7.9",
"dotenv": "^16.4.7",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.1.3"
Expand Down
33 changes: 33 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions scripts/release-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env node

const axios = require("axios");
const fs = require("fs");
require("dotenv").config();

const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
const REPO_OWNER = "covalenthq";
const REPO_NAME = "ai-agent-sdk";
const RELEASE_TAG = "v0.2.0";

async function getContributors(owner, repo, releaseTag) {
const url = `https://api.github.com/repos/${owner}/${repo}/commits?sha=${releaseTag}`;
const headers = {
Authorization: `token ${GITHUB_TOKEN}`,
Accept: "application/vnd.github.v3+json",
};

try {
const response = await axios.get(url, { headers });
const commits = response.data;

const contributors = new Set();
commits.forEach((commit) => {
if (commit.author && commit.author.login) {
contributors.add(commit.author.login);
} else if (commit.commit && commit.commit.author) {
contributors.add(commit.commit.author.name);
}
});

return Array.from(contributors);
} catch (error) {
console.error("Error fetching contributors: ", error);
return [];
}
}

function generateReleaseNotes(contributors) {
let releaseNotes = `## Release ${RELEASE_TAG}\n\n`;
releaseNotes += "### Contributors\n\n";
releaseNotes += contributors
.map((contributor) => `- @${contributor}`)
.join("\n");
return releaseNotes;
}

async function main() {
const contributors = await getContributors(
REPO_OWNER,
REPO_NAME,
RELEASE_TAG
);
const releaseNotes = generateReleaseNotes(contributors);
console.log(releaseNotes);

// Optionally, write the release notes to a file
fs.writeFileSync(`release_notes_${RELEASE_TAG}.md`, releaseNotes);
}

main();