Skip to content

Commit

Permalink
require
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 11, 2024
1 parent 315b4bd commit 18c6751
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/supersetbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ jobs:
- name: Execute SupersetBot Command
uses: actions/github-script@v7
with:
user-agent: actions/github-script
result-encoding: json
script: |
const cmd = context.eventName === 'workflow_dispatch'
? context.payload.inputs.comment_body
: context.payload.comment.body;
const { runCliCommand } = require('.github/workflows/supersetbot/src/index.js');
runCliCommand(cmd);
(async () => {
const cmd = context.eventName === 'workflow_dispatch'
? context.payload.inputs.comment_body
: context.payload.comment.body;
const modulePath = '.github/workflows/supersetbot/src/index.js';
const { runCliCommand } = await import(modulePath);
runCliCommand(cmd);
})();
2 changes: 1 addition & 1 deletion .github/workflows/supersetbot/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ program.command('orglabel')
.action(async function (commandOptions) {
const opts = { ...commandOptions, ...this.parent.opts() };
requireOptions(['issue', 'repo'], opts);
await wrap(commands.unlabel)(opts.repo, opts.issue, envContext.github);
await wrap(commands.assignOrgLabel)(opts.repo, opts.issue, envContext.github);
console.log(`SUCCESS: added the right labels`);
});

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/supersetbot/src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export function unlabel(repo, issueNumber, label, github) {
name: label,
});
}
/*
export function assignOrgLabel(issue, github) {

export async function assignOrgLabel(issueNumber, github) {

const username = issue.user.login;
const orgs = await github.orgs.listForUser({ username });
const orgNames = orgs.data.map(v => v.login);
Expand All @@ -74,4 +75,3 @@ export function assignOrgLabel(issue, github) {
context.issue({ issue_number: issue.number, labels: [org] }));
});
}
*/

0 comments on commit 18c6751

Please sign in to comment.