Skip to content

Commit

Permalink
chore: update changes (#3)
Browse files Browse the repository at this point in the history
* chore: update tsconfig

* chore: fix errors

* chore: update node js version

* chore: add node dependency and grab token

* chore: test different naming of token

* chore: revert token and add info for debug

* chore: test changes

* chore: test changes
  • Loading branch information
Anmol-Baranwal authored Oct 15, 2023
1 parent 63a3cb9 commit e232044
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
26 changes: 23 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import * as core from "@actions/core";
import * as github from "@actions/github";
// import * as core from "@actions/core";
// import * as github from "@actions/github";

import core = require("@actions/core");
import github = require("@actions/github");

async function run() {
try {
const token = core.getInput("GITHUB_TOKEN");
const token = process.env.GITHUB_TOKEN;

if (!token) core.debug(token + "");
else core.debug(token);

if (!token) {
core.setFailed(
"GitHub token is missing. Make sure to set the GITHUB_TOKEN secret."
);
return;
}

const octokit = github.getOctokit(token);
const context = github.context;

core.notice("step 1.");

// Retrieve custom inputs
const label = core.getInput("label") || "up for grabs"; // Set default label
const issueNumber = core.getInput("issueNumber") === "true"; // converts to boolean
Expand All @@ -16,6 +32,8 @@ async function run() {
// Check if the same author has open issues
const author = context.payload.issue?.user.login;

core.notice("step 2.");

const { data: authorIssues } = await octokit.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -28,6 +46,8 @@ async function run() {
return; // No need to continue.
}

core.notice("step 3.");

for (const authorIssue of authorIssues) {
const issueNumberToLabel = authorIssue.number;

Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"devDependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@types/node": "^20.8.6",
"typescript": "^5.2.2"
}
}

0 comments on commit e232044

Please sign in to comment.