Skip to content

Commit

Permalink
fix: fix api call
Browse files Browse the repository at this point in the history
  • Loading branch information
ad2ien committed Jun 29, 2022
1 parent d5cc895 commit cee4cd8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
25 changes: 14 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9048,19 +9048,22 @@ __nccwpck_require__.r(__webpack_exports__);



run()
run();

async function run() {
try {
// Get inputs
const token = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)("token")
const username = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)("username")

result = await (0,_actions_github__WEBPACK_IMPORTED_MODULE_1__.getOctokit)(token).rest.users.follow(username)
} catch (error) {
console.log(error)
;(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed)(error.message)
}
try {
// Get inputs
const token = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)("token");
const login = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)("username");


result = await (0,_actions_github__WEBPACK_IMPORTED_MODULE_1__.getOctokit)(token).rest.users.follow({
username: login,
});
} catch (error) {
console.log(error);
(0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.setFailed)(error.message);
}
}

})();
Expand Down
27 changes: 15 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { getInput, setFailed } from '@actions/core'
import { getOctokit } from '@actions/github'
import { getInput, setFailed } from "@actions/core";
import { getOctokit } from "@actions/github";

run()
run();

async function run() {
try {
// Get inputs
const token = getInput("token")
const username = getInput("username")
try {
// Get inputs
const token = getInput("token");
const login = getInput("username");

result = await getOctokit(token).rest.users.follow(username)
} catch (error) {
console.log(error)
setFailed(error.message)
}
const result = await getOctokit(token).rest.users.follow({
username: login,
});
console.log(result);
} catch (error) {
console.log(error);
setFailed(error.message);
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/ad2ien/verify-user-membership.git"
"url": "git+https://github.com/ad2ien/follow-contributor-action.git"
},
"keywords": [
"github",
Expand All @@ -18,9 +18,9 @@
"author": "OKP4",
"license": "MIT",
"bugs": {
"url": "https://github.com/ad2ien/verify-user-membership/issues"
"url": "https://github.com/ad2ien/follow-contributor-action/issues"
},
"homepage": "https://github.com/ad2ien/verify-user-membership#readme",
"homepage": "https://github.com/ad2ien/follow-contributor-action#readme",
"dependencies": {
"@actions/core": "^1.9.0",
"@actions/github": "^5.0.3"
Expand Down

0 comments on commit cee4cd8

Please sign in to comment.