Skip to content

Commit

Permalink
Merge pull request #23 from kunai-consulting/linear-soc2
Browse files Browse the repository at this point in the history
feat: try reading files directly in script
  • Loading branch information
thejackshelton-kunaico authored Aug 22, 2024
2 parents e984a6d + 18ab469 commit bc21c52
Showing 3 changed files with 22 additions and 20 deletions.
8 changes: 0 additions & 8 deletions .changeset/README.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import { LinearClient } from "@linear/sdk";
import path from "node:path";
import fs from "node:fs";

const linearClient = new LinearClient({ apiKey: process.env.LINEAR_API_KEY });

const team = await linearClient.team("QWIK");
const project = await linearClient.project("af4d86af8e3f");

const prTitle = process.env.PR_TITLE || "No PR Title";
const prDescription = process.env.PR_DESCRIPTION || "No PR Description";
let prDescription: string;

// Read contents of .changeset directory
function readChangesetFiles() {
const changesetDir = path.join(process.cwd(), ".changeset");
if (fs.existsSync(changesetDir)) {
const files = fs.readdirSync(changesetDir);

for (const file of files) {
if (path.extname(file) === ".md") {
const content = fs.readFileSync(path.join(changesetDir, file), "utf-8");
prDescription += content;
}
}
}
}

readChangesetFiles();

const existingIssues = await linearClient.issues({
filter: {
@@ -57,9 +76,9 @@ async function updateLinearReleaseIssue() {

try {
if (existingIssue) {
await createLinearReleaseIssue();
} else {
await updateLinearReleaseIssue();
} else {
await createLinearReleaseIssue();
}
} catch (e) {
console.error("Error from creating linear ticket script: ", e);
9 changes: 0 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -81,18 +81,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 📜 Generate Changelog
id: generate-changelog
run: |
pnpm changeset status --output=verbose > changelog.txt
echo "PR_DESCRIPTION<<EOF" >> $GITHUB_ENV
cat changelog.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: 💥 Create Linear Release Issue
if: steps.changesets.outputs.pullRequestNumber
env:
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
PR_TITLE: "Release QDS v${{ env.NEW_VERSION }}"
PR_DESCRIPTION: ${{ steps.generate-changelog.outputs.PR_DESCRIPTION }}
run: pnpm vite-node .github/scripts/create-linear-issue.ts

0 comments on commit bc21c52

Please sign in to comment.