Skip to content
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

chore(NODE-6170): update release please owner #35

Merged
merged 2 commits into from
Jun 4, 2024
Merged
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
35 changes: 16 additions & 19 deletions .github/scripts/highlights.mjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
// @ts-check
import * as process from 'node:process';
import { Octokit } from '@octokit/core';
import { output } from './util.mjs';

const {
GITHUB_TOKEN = '',
PR_LIST = '',
owner = 'mongodb-js',
repo = 'nodejs-mongodb-legacy'
REPOSITORY = ''
} = process.env;
if (GITHUB_TOKEN === '') throw new Error('GITHUB_TOKEN cannot be empty');
if (REPOSITORY === '') throw new Error('REPOSITORY cannot be empty')

const octokit = new Octokit({
auth: GITHUB_TOKEN,
log: {
debug: msg => console.error('Octokit.debug', msg),
info: msg => console.error('Octokit.info', msg),
warn: msg => console.error('Octokit.warn', msg),
error: msg => console.error('Octokit.error', msg)
const API_REQ_INFO = {
headers: {
Accept: 'application/vnd.github.v3+json',
'X-GitHub-Api-Version': '2022-11-28',
Authorization: `Bearer ${GITHUB_TOKEN}`
}
});
}

const prs = PR_LIST.split(',').map(pr => {
const prNum = Number(pr);
Expand All @@ -35,13 +32,10 @@ async function getPullRequestContent(pull_number) {

let body;
try {
const res = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', {
owner,
repo,
pull_number,
headers: { 'X-GitHub-Api-Version': '2022-11-28' }
});
body = res.data.body;
const response = await fetch(new URL(`https://api.github.com/repos/${REPOSITORY}/pulls/${pull_number}`), API_REQ_INFO);
if (!response.ok) throw new Error(await response.text());
const pr = await response.json();
body = pr.body;
} catch (error) {
console.log(`Could not get PR ${pull_number}, skipping. ${error.status}`);
return '';
Expand Down Expand Up @@ -70,7 +64,10 @@ async function pullRequestHighlights(prs) {
if (!highlights.length) return '';

highlights.unshift('## Release Notes\n\n');
return highlights.join('\n\n');

const highlight = highlights.join('\n\n');
console.log(`Total highlight is ${highlight.length} characters long`);
return highlight;
}

console.log('List of PRs to collect highlights from:', prs);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- id: release
uses: google-github-actions/release-please-action@v4
uses: googleapis/release-please-action@v4

# If release-please created a release, publish to npm
- if: ${{ steps.release.outputs.release_created }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release_notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
PR_LIST: ${{ steps.pr_list.outputs.pr_list }}
REPOSITORY: ${{ github.repository }}

# The combined output is available
- id: release_notes
Expand Down
199 changes: 0 additions & 199 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"license": "Apache-2.0",
"devDependencies": {
"@microsoft/api-extractor-model": "^7.28.14",
"@octokit/core": "^6.1.2",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"chai": "^4.4.1",
Expand Down