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

feat: cli argument to pass the issue URL to the program #7

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d4e9116
feat: cli argument to pass the issue URL to the program
gentlementlegen Apr 2, 2024
423f49e
feat: moved tsx to production dependencies
gentlementlegen Apr 2, 2024
d5f3526
chore: set output of action in github result variable
gentlementlegen Apr 2, 2024
d081f2d
chore: fix output string format
gentlementlegen Apr 2, 2024
bb555a8
chore: fix output string format
gentlementlegen Apr 2, 2024
4e7ae14
chore: fix output string format
gentlementlegen Apr 2, 2024
6574889
chore: fix output string format
gentlementlegen Apr 2, 2024
6a800de
chore: fix action to be one step
gentlementlegen Apr 2, 2024
2355c02
chore: format output string for one line
gentlementlegen Apr 2, 2024
847829a
chore: added local test script action
gentlementlegen Apr 2, 2024
26cf92a
chore: added awk format
gentlementlegen Apr 2, 2024
f133d29
chore: escape result json
gentlementlegen Apr 2, 2024
287f58d
chore: remove pretty print to ease parsing
gentlementlegen Apr 3, 2024
8360d5b
chore: remove pretty print to ease parsing
gentlementlegen Apr 3, 2024
5efee13
chore: api key added
gentlementlegen Apr 3, 2024
4c38c85
chore: debug for sampling
gentlementlegen Apr 3, 2024
598f36a
chore: debug for sampling
gentlementlegen Apr 3, 2024
9430c90
chore: debug for sampling
gentlementlegen Apr 3, 2024
c72c562
chore: update output command
gentlementlegen Apr 3, 2024
0893a23
chore: update output command
gentlementlegen Apr 3, 2024
ea3c37c
chore: update output command
gentlementlegen Apr 3, 2024
eb309ac
chore: update output command
gentlementlegen Apr 3, 2024
bc844e7
chore: update output command
gentlementlegen Apr 3, 2024
6e313fa
chore: multiline result match
gentlementlegen Apr 3, 2024
c7a7948
chore: set result in file
gentlementlegen Apr 3, 2024
e17bffc
chore: set result in file
gentlementlegen Apr 3, 2024
8788a76
chore: set result in file
gentlementlegen Apr 3, 2024
0e0c21f
chore: set result in file
gentlementlegen Apr 3, 2024
e6b0503
chore: set result in file
gentlementlegen Apr 3, 2024
707b5c6
chore: delete test action
gentlementlegen Apr 3, 2024
146580e
fix: remove build action and changed trigger for Jest testing
gentlementlegen Apr 3, 2024
1160614
fix: cspell ignore words
gentlementlegen Apr 3, 2024
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
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: "Conversation Rewards"
description: "Compute rewards for contributors' discussion on issues that are closed as complete."
inputs:
authentication_token:
description: "The GitHub authentication token"
issue_url:
description: "The URL the the issue needing to be parsed"
required: true
outputs:
result: # id of output
description: "The result of a event handler"
value: ${{ steps.main.outputs.result}}
result:
description: "The result containing all the rewards of the users"
value: ${{ steps.main.outputs.result }}
runs:
using: "composite"
steps:
- run: |
yarn --cwd ${{ github.action_path }} --production=true
yarn --cwd ${{ github.action_path }} start --auth ${{ inputs.authentication_token }}
yarn --cwd ${{ github.action_path }} start --issue ${{ inputs.issue_url }}
id: main
shell: bash
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"test": "jest --setupFiles dotenv/config --coverage",
"start": "tsx src/start.ts",
"start": "tsx src/index.ts",
"format": "run-s format:lint format:prettier format:cspell",
"format:lint": "eslint --fix .",
"format:prettier": "prettier --write .",
Expand All @@ -36,6 +36,7 @@
"jsdom": "24.0.0",
"markdown-it": "14.1.0",
"openai": "4.29.1",
"tsx": "4.7.1",
"yaml": "2.4.1"
},
"devDependencies": {
Expand Down Expand Up @@ -68,7 +69,6 @@
"npm-run-all": "4.1.5",
"prettier": "3.2.5",
"ts-node": "^10.9.2",
"tsx": "4.7.1",
"typescript": "5.3.3"
},
"lint-staged": {
Expand Down
16 changes: 16 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { IssueActivity } from "./issue-activity";
import program from "./parser/command-line";
import { Processor } from "./parser/processor";
import { parseGitHubUrl } from "./start";

async function main() {
const issueUrl = program.opts().issue;
const issue = parseGitHubUrl(issueUrl);
const activity = new IssueActivity(issue);
await activity.init();
const processor = new Processor();
await processor.run(activity);
processor.dump();
}

main().catch((e) => console.error("Failed to run comment evaluation:", e));
8 changes: 8 additions & 0 deletions src/parser/command-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import packageJson from "../../package.json";

config();

// On test mode pass the env value directly to the CLI
if (process.env.NODE_ENV === "test") {
process.argv.splice(2);
process.argv.push("-i");
process.argv.push(`${process.env.TEST_ISSUE_URL}`);
}

const program = new Command()
.requiredOption("-i, --issue <url>", "The url of the issue to parse")
.option("-c, --config <path>", "The path to the desired configuration to use", "rewards-configuration.default.yml")
.option("-f, --file <file>", "The target file to store the results in")
.version(packageJson.version)
Expand Down
Loading