diff --git a/dist/index.js b/dist/index.js
index c302834..f0a3af3 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -45309,6 +45309,7 @@ var axios_default = axios;
// src/index.ts
var import_sanitize_html = __toESM(require_sanitize_html(), 1);
+import {readFile} from "node:fs/promises";
var email = core.getInput("email");
var apiKey = core.getInput("api-key");
var projectId = core.getInput("project-id");
@@ -45348,19 +45349,20 @@ try {
}
let userPairing;
try {
- userPairing = (await Bun.file(".github/freelo.txt").text()).split("\n");
- } catch (_) {
+ userPairing = (await readFile("./.github/freelo.txt", { encoding: "utf-8" })).split("\n");
+ } catch (e) {
console.log("No freelo.txt found in .github folder, skipping");
}
if (tasklistId) {
switch (action) {
case "opened": {
- const author = userPairing && userPairing.filter((u) => u.includes(issue.user.login)).length > 0 ? `
@${issue.user.login}
` : `@${issue.user.login}`;
+ const author = userPairing && userPairing.filter((u) => u.includes(issue.user.login)).length > 0 ? `@${issue.user.login}
` : `${issue.user.login}`;
+ console.log(userPairing?.filter((u) => u.includes(issue.user.login)).length);
const taskComment = `
- Created by: ${author}
- Description: ${import_sanitize_html.default(issue.body ?? "None", sanitizeOptions)}
- GitHub issue: #${issue.number}
- (This action was performed automatically)
+ Created by: ${author}
+ Description: ${import_sanitize_html.default(issue.body ?? "None", sanitizeOptions)}
+ GitHub issue: #${issue.number}
+ (This action was performed automatically)
`;
const taskContent = {
name: issue.title,
@@ -45381,7 +45383,7 @@ try {
}
octokit.rest.issues.createComment({
issue_number: issue.number,
- owner: github.context.payload.repository?.name ?? "",
+ owner: github.context.payload.repository?.owner.login ?? "",
repo: github.context.payload.repository?.name ?? "",
body: `Freelo task assigned: ${res.data.id}
Please do not edit or delete this comment as it is used to prevent duplication of tasks.`
});
diff --git a/src/index.ts b/src/index.ts
index 8733686..a1b3656 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -3,6 +3,7 @@ import { context, getOctokit } from "@actions/github";
import axios from "axios";
import sanitize from "sanitize-html";
import type { NewTask } from "./freelo";
+import { readFile } from "node:fs/promises";
// user input
const email = getInput("email");
@@ -57,8 +58,8 @@ try {
// Load GitHub:Freelo pairing if available
let userPairing: string[] | undefined;
try {
- userPairing = (await Bun.file(".github/freelo.txt").text()).split("\n");
- } catch (_) {
+ userPairing = (await readFile("./.github/freelo.txt",{encoding:"utf-8"})).split("\n");
+ } catch (e) {
console.log("No freelo.txt found in .github folder, skipping");
}
@@ -70,12 +71,13 @@ try {
userPairing &&
userPairing.filter((u) => u.includes(issue.user.login)).length > 0
? `@${issue.user.login}
`
- : `@${issue.user.login}`;
+ : `${issue.user.login}`;
+ console.log(userPairing?.filter((u) => u.includes(issue.user.login)).length)
const taskComment = `
- Created by: ${author}
- Description: ${sanitize(issue.body ?? "None", sanitizeOptions)}
- GitHub issue: #${issue.number}
- (This action was performed automatically)
+ Created by: ${author}
+ Description: ${sanitize(issue.body ?? "None", sanitizeOptions)}
+ GitHub issue: #${issue.number}
+ (This action was performed automatically)
`;
const taskContent: NewTask = {
@@ -106,7 +108,7 @@ try {
// create an issue comment so we can track if the task has been already created
octokit.rest.issues.createComment({
issue_number: issue.number,
- owner: context.payload.repository?.name ?? "",
+ owner: context.payload.repository?.owner.login ?? "",
repo: context.payload.repository?.name ?? "",
body: `Freelo task assigned: ${res.data.id}
Please do not edit or delete this comment as it is used to prevent duplication of tasks.`,
});