diff --git a/README.md b/README.md index d26da0a..f8312ec 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,7 @@ Easily connect to the smart Issue Sentinel with this GitHub Action. It helps you To use the Issue Sentinel, follow these steps: -1. Contact AzPyCLI@microsoft.com to get the password for the Sentinel. We will assist you with onboarding and add your repository to the database. - -1. Add the `ISSUE_SENTINEL_PASSWORD` as a secret to your repository. Go to `Settings > Secrets and variables > Actions > New repository secret`. +1. Contact AzPyCLI@microsoft.com to get the permission for the Sentinel. We will assist you with onboarding and add your repository to the database. 1. Add the following workflow in your repository. @@ -28,7 +26,6 @@ To use the Issue Sentinel, follow these steps: - name: Run Issue Sentinel uses: Azure/issue-sentinel@v1 with: - password: ${{secrets.ISSUE_SENTINEL_PASSWORD}} enable-similar-issues-scanning: true # Scan similar issues in your repo, default: true enable-security-issues-scanning: true # Scan security issues in your repo, default: false ``` diff --git a/action.yml b/action.yml index 19be067..c88dbf7 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,6 @@ name: 'Issue Sentinel' description: 'Get similar issues by Issue Sentinel' inputs: - password: - description: 'Password to access the Issue Sentinel' - required: true github-token: description: 'The GitHub token used to create an authenticated client' default: ${{ github.token }} diff --git a/dist/index.js b/dist/index.js index f5b7e5d..d693a00 100644 --- a/dist/index.js +++ b/dist/index.js @@ -32641,7 +32641,6 @@ const PoweredBy = "\n_Powered by [issue-sentinel](https://github.com/Azure/issue function main() { return __awaiter(this, void 0, void 0, function* () { try { - const password = core.getInput('password'); //TODO: use github token for authentication const token = core.getInput('github-token', { required: true }); const enable_similar_issues_scanning = core.getInput('enable-similar-issues-scanning'); @@ -32658,7 +32657,7 @@ function main() { core.debug(`Issue: ${JSON.stringify(issue)}`); const { owner, repo } = context.repo; if (enable_similar_issues_scanning === 'true') { - yield handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl); + yield handleSimilarIssuesScanning(issue, owner, repo, token, botUrl); } if (enable_security_issues_scanning === 'true') { core.debug(`Issue trigger: ${context.payload.action}`); @@ -32666,7 +32665,7 @@ function main() { core.info('Skip security issues scanning for edited and closed issue.'); return; } - yield handleSecurityIssuesScanning(issue, owner, repo, password, token, botUrl); + yield handleSecurityIssuesScanning(issue, owner, repo, token, botUrl); } } catch (error) { @@ -32674,7 +32673,7 @@ function main() { } }); } -function handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl) { +function handleSimilarIssuesScanning(issue, owner, repo, token, botUrl) { return __awaiter(this, void 0, void 0, function* () { const octokit = github.getOctokit(token); const issueNumber = issue.number; @@ -32685,7 +32684,7 @@ function handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl if (if_closed) { yield axios_1.default.post(botUrl + '/update_issue/', { 'raw': issue, - 'password': password + 'token': token }); core.info('This issue was closed. Update it to issue sentinel.'); return; @@ -32693,20 +32692,19 @@ function handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl const if_replied = (yield axios_1.default.post(botUrl + '/check_reply/', { 'repo': owner_repo, 'issue': issue.number, - 'password': password + 'token': token })).data.result; core.info('Check if this issue was already replied by the sentinel: ' + if_replied.toString()); if (if_replied) { yield axios_1.default.post(botUrl + '/update_issue/', { 'raw': issue, - 'password': password + 'token': token }); core.info('This issue was already replied by the sentinel. Update the edited content to sentinel and skip this issue.'); return; } const response = (yield axios_1.default.post(botUrl + '/search/', { 'raw': issue, - 'password': password, 'verify': true, 'token': token //used for access issue comment to get possible solution })).data; @@ -32749,7 +32747,7 @@ function handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl const if_replied_again = (yield axios_1.default.post(botUrl + '/check_reply/', { 'repo': owner_repo, 'issue': issue.number, - 'password': password + 'token': token })).data.result; if (if_replied_again) { core.info('This issue was already replied by the sentinel during processing. Skip adding labels and comments.'); @@ -32777,12 +32775,12 @@ function handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl yield axios_1.default.post(botUrl + '/add_reply/', { 'repo': owner_repo, 'issue': issue.number, - 'password': password + 'token': token }); core.info('Save replied issue to issue sentinel.'); }); } -function handleSecurityIssuesScanning(issue, owner, repo, password, token, botUrl) { +function handleSecurityIssuesScanning(issue, owner, repo, token, botUrl) { return __awaiter(this, void 0, void 0, function* () { const octokit = github.getOctokit(token); const issueNumber = issue.number; @@ -32798,7 +32796,7 @@ function handleSecurityIssuesScanning(issue, owner, repo, password, token, botUr } const if_security = (yield axios_1.default.post(botUrl + '/security/', { 'raw': issue, - 'password': password + 'token': token })).data.security; core.info('Search the security issues by the issue sentinel successfully.'); core.debug(`Response: ${if_security}`); diff --git a/src/main.ts b/src/main.ts index 2d1469d..d6f4758 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,7 +6,6 @@ const PoweredBy = "\n_Powered by [issue-sentinel](https://github.com/Azure/issue async function main() { try { - const password = core.getInput('password'); //TODO: use github token for authentication const token = core.getInput('github-token', { required: true }); const enable_similar_issues_scanning = core.getInput('enable-similar-issues-scanning'); @@ -25,7 +24,7 @@ async function main() { const { owner, repo } = context.repo; if (enable_similar_issues_scanning === 'true') { - await handleSimilarIssuesScanning(issue, owner, repo, password, token, botUrl); + await handleSimilarIssuesScanning(issue, owner, repo, token, botUrl); } if (enable_security_issues_scanning === 'true') { @@ -34,7 +33,7 @@ async function main() { core.info('Skip security issues scanning for edited and closed issue.'); return; } - await handleSecurityIssuesScanning(issue, owner, repo, password, token, botUrl); + await handleSecurityIssuesScanning(issue, owner, repo, token, botUrl); } } catch (error: any) { @@ -42,7 +41,7 @@ async function main() { } } -async function handleSimilarIssuesScanning(issue: any, owner: string, repo: string, password: string, token: string, botUrl: string) { +async function handleSimilarIssuesScanning(issue: any, owner: string, repo: string, token: string, botUrl: string) { const octokit = github.getOctokit(token); const issueNumber = issue.number; let owner_repo = `${owner}/${repo}`; @@ -53,7 +52,7 @@ async function handleSimilarIssuesScanning(issue: any, owner: string, repo: stri if (if_closed) { await axios.post(botUrl + '/update_issue/', { 'raw': issue, - 'password': password + 'token': token }) core.info('This issue was closed. Update it to issue sentinel.'); return; @@ -62,14 +61,14 @@ async function handleSimilarIssuesScanning(issue: any, owner: string, repo: stri const if_replied: boolean = (await axios.post(botUrl + '/check_reply/', { 'repo': owner_repo, 'issue': issue.number, - 'password': password + 'token': token })).data.result; core.info('Check if this issue was already replied by the sentinel: ' + if_replied.toString()); if (if_replied) { await axios.post(botUrl + '/update_issue/', { 'raw': issue, - 'password': password + 'token': token }) core.info('This issue was already replied by the sentinel. Update the edited content to sentinel and skip this issue.'); return; @@ -77,7 +76,6 @@ async function handleSimilarIssuesScanning(issue: any, owner: string, repo: stri const response = (await axios.post(botUrl + '/search/', { 'raw': issue, - 'password': password, 'verify': true, 'token': token //used for access issue comment to get possible solution })).data; @@ -124,7 +122,7 @@ async function handleSimilarIssuesScanning(issue: any, owner: string, repo: stri const if_replied_again: boolean = (await axios.post(botUrl + '/check_reply/', { 'repo': owner_repo, 'issue': issue.number, - 'password': password + 'token': token })).data.result; if (if_replied_again) { @@ -156,12 +154,12 @@ async function handleSimilarIssuesScanning(issue: any, owner: string, repo: stri await axios.post(botUrl + '/add_reply/', { 'repo': owner_repo, 'issue': issue.number, - 'password': password + 'token': token }); core.info('Save replied issue to issue sentinel.'); } -async function handleSecurityIssuesScanning(issue: any, owner: string, repo: string, password: string, token: string, botUrl: string) { +async function handleSecurityIssuesScanning(issue: any, owner: string, repo: string, token: string, botUrl: string) { const octokit = github.getOctokit(token); const issueNumber = issue.number; const { data: existedLabels } = await octokit.rest.issues.listLabelsOnIssue({ @@ -178,7 +176,7 @@ async function handleSecurityIssuesScanning(issue: any, owner: string, repo: str const if_security = (await axios.post(botUrl + '/security/', { 'raw': issue, - 'password': password + 'token': token })).data.security; core.info('Search the security issues by the issue sentinel successfully.'); core.debug(`Response: ${if_security}`);