Skip to content

Commit

Permalink
Add prettier eslint husky
Browse files Browse the repository at this point in the history
  • Loading branch information
vj-abishek committed Jan 13, 2021
1 parent d12cf78 commit 077fd7c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
54 changes: 27 additions & 27 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ const core = require('@actions/core');
const github = require('@actions/github');

const main = async () => {
try {
const { ACCESS_TOKEN } = process.env;
if (!ACCESS_TOKEN) {
return core.setFailed('ENV required and not supplied: ACCESS_TOKEN');
}
try {
const { ACCESS_TOKEN } = process.env;
if (!ACCESS_TOKEN) {
return core.setFailed('ENV required and not supplied: ACCESS_TOKEN');
}

const octokit = github.getOctokit(ACCESS_TOKEN);
const octokit = github.getOctokit(ACCESS_TOKEN);

const { payload } = github.context;
const inviteeId = payload.issue.user.id;
const currentLabel = payload.label.name;
const { payload } = github.context;
const inviteeId = payload.issue.user.id;
const currentLabel = payload.label.name;

const org = core.getInput('organization', { required: true });
const label = core.getInput('label', { required: true });
const org = core.getInput('organization', { required: true });
const label = core.getInput('label', { required: true });

if (currentLabel === label) {
try {
await octokit.orgs.checkMembership({
org,
username: payload.issue.user.login,
});
} catch (error) {
await octokit.orgs.createInvitation({
org,
invitee_id: inviteeId,
});
}
if (currentLabel === label) {
try {
await octokit.orgs.checkMembership({
org,
username: payload.issue.user.login,
});
} catch (error) {
await octokit.orgs.createInvitation({
org,
invitee_id: inviteeId,
});
}
}
} catch (error) {
return core.setFailed(error.message);
}
} catch (error) {
return core.setFailed(error.message);
}
return core.setOutput('Invitation sent successfully');
return core.setOutput('Invitation sent successfully 🎉');
};
main();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
},
"lint-staged": {
"**/*.{js,ts}": [
"*.{js,ts}": [
"npx prettier --write",
"eslint *.js --fix-dry-run"
]
Expand Down

0 comments on commit 077fd7c

Please sign in to comment.