Skip to content

Commit

Permalink
ci: Add generation of changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Sep 11, 2023
1 parent b534f73 commit a28f083
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,29 @@ jobs:
path: |
./
!./node_modules
generateChangelog:
name: Generate changelog
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0 # fetch all history

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version-file: '.node-version'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Generate changelog
run: npm run changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 8 additions & 5 deletions scripts/gen-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const labelsConfig: { [label: string]: { section: string; fold?: boolean } } = {
fold: true,
},
};
const { GH_TOKEN } = process.env;
const { GITHUB_TOKEN } = process.env;

if (GH_TOKEN == null) {
console.error('Must provide GH_TOKEN as environment variable!');
if (GITHUB_TOKEN == null) {
console.error('Must provide GITHUB_TOKEN as environment variable!');
process.exit(1);
}

Expand All @@ -55,7 +55,10 @@ const { githubOrg, githubRepo } = repoURLMatch.groups;

genChangeLog()
.then((result) => process.stdout.write(result))
.catch((e) => console.error(e));
.catch((e) => {
console.error(e);
process.exit(1);
});

async function genChangeLog(): Promise<string> {
const { version } = packageJSON;
Expand Down Expand Up @@ -136,7 +139,7 @@ async function graphqlRequest(query: string) {
const response = await fetch('https://api.github.com/graphql', {
method: 'POST',
headers: {
Authorization: 'bearer ' + GH_TOKEN,
Authorization: 'bearer ' + GITHUB_TOKEN,
'Content-Type': 'application/json',
'User-Agent': 'gen-changelog',
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/viewport.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ g.graph > polygon {
}

/* Nodes Styling */
.node {
.node .entity {
pointer-events: bounding-box;
cursor: pointer;

Expand Down

0 comments on commit a28f083

Please sign in to comment.