From a2bab41b23e88c116e017d8bd3136d889427b3a1 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:05:07 -0600 Subject: [PATCH 01/32] test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 150c4c6..8e93146 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ on: [pull_request] jobs: confirm-link: runs-on: ubuntu-latest - name: This action will look for a link matching a regEx (eg, http://trello.com) in PR. + name: This action will look for a link matching a regEx (eg, http://trello.com) in Pull Request. steps: - name: Confirm Link id: confirm From 0ed03f5588f271f04c7f1ad747763c47a7f42797 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:10:36 -0600 Subject: [PATCH 02/32] trigger GitHub actions From 6a3cfba5fd05b2edf46ede4141161cc967d6ed38 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:24:23 -0600 Subject: [PATCH 03/32] test --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 375ba60..ebce26c 100644 --- a/index.js +++ b/index.js @@ -11,8 +11,15 @@ try { core.setOutput("link", linkRegEx); core.setOutput("time", false); + const payload = github.context.payload; + github.pulls.get({ + owner: payload.organization.login, + repo: payload.repository.name, + pull_number: payload.pull_request.number + }) + // Get the JSON webhook payload for the event that triggered the workflow - const payload = JSON.stringify(github.context.payload, undefined, 2) + const payload = JSON.stringify(github.context, undefined, 2) console.log(`The event payload: ${payload}`); } catch (error) { core.setFailed(error.message); From e2cae3de271e62b1d49653fe636fa1c8d1685d7f Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:25:32 -0600 Subject: [PATCH 04/32] test --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ebce26c..b845087 100644 --- a/index.js +++ b/index.js @@ -12,15 +12,16 @@ try { core.setOutput("time", false); const payload = github.context.payload; - github.pulls.get({ + const pr = github.pulls.get({ owner: payload.organization.login, repo: payload.repository.name, pull_number: payload.pull_request.number }) + console.log(pr); + // Get the JSON webhook payload for the event that triggered the workflow const payload = JSON.stringify(github.context, undefined, 2) - console.log(`The event payload: ${payload}`); } catch (error) { core.setFailed(error.message); } \ No newline at end of file From 05595c0427037e6bc68109214567c4b0205a608c Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:30:22 -0600 Subject: [PATCH 05/32] test --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index b845087..71e9741 100644 --- a/index.js +++ b/index.js @@ -12,13 +12,13 @@ try { core.setOutput("time", false); const payload = github.context.payload; - const pr = github.pulls.get({ + const prComments = github.issue_comments.get({ owner: payload.organization.login, repo: payload.repository.name, - pull_number: payload.pull_request.number + issue_numer: payload.pull_request.number }) - console.log(pr); + console.log(prComments); // Get the JSON webhook payload for the event that triggered the workflow const payload = JSON.stringify(github.context, undefined, 2) From bd548ec60223958bfa03701f37570fab0234b263 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:31:51 -0600 Subject: [PATCH 06/32] test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e93146..2b76732 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Confirm Link id: confirm - uses: delivered/trello-github-action/@7e9cf84 + uses: delivered/trello-github-action/@my-first-pr with: link-regex: 'https://trello.com' - name: Get the output time From f189f9fd0ee6c463526a96f2b2b4d93395a21ad4 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:33:47 -0600 Subject: [PATCH 07/32] test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b76732..9e35686 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: steps: - name: Confirm Link id: confirm - uses: delivered/trello-github-action/@my-first-pr + uses: delivered/trello-github-action/@MM-first-pr with: link-regex: 'https://trello.com' - name: Get the output time From bb37ff7a7adf9304ce889c626b2ed48f3c817350 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:38:02 -0600 Subject: [PATCH 08/32] test --- index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/index.js b/index.js index 71e9741..e8bcc71 100644 --- a/index.js +++ b/index.js @@ -19,9 +19,6 @@ try { }) console.log(prComments); - - // Get the JSON webhook payload for the event that triggered the workflow - const payload = JSON.stringify(github.context, undefined, 2) } catch (error) { core.setFailed(error.message); } \ No newline at end of file From ccddfeb1cbf4a5d33702a6c8ce8162fbd15d2505 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:44:10 -0600 Subject: [PATCH 09/32] test --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e8bcc71..c7b93ca 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ try { core.setOutput("time", false); const payload = github.context.payload; - const prComments = github.issue_comments.get({ + const prComments = github.issues.listComments({ owner: payload.organization.login, repo: payload.repository.name, issue_numer: payload.pull_request.number @@ -20,5 +20,6 @@ try { console.log(prComments); } catch (error) { - core.setFailed(error.message); + console.log(error); + core.setFailed(error.message); } \ No newline at end of file From 81e547a2a3ddadc76f3429124fad5845a53b427d Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:52:17 -0600 Subject: [PATCH 10/32] test --- .github/workflows/main.yml | 3 ++- index.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e35686..ba34772 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,5 +10,6 @@ jobs: uses: delivered/trello-github-action/@MM-first-pr with: link-regex: 'https://trello.com' + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Get the output time - run: echo "The time was ${{ steps.confirm.outputs.time }}. Link ${{steps.confirm.outputs.link}}" \ No newline at end of file + run: echo "The time was ${{ steps.confirm.outputs.time }}. Link ${{steps.confirm.outputs.link}}" diff --git a/index.js b/index.js index c7b93ca..bd52c69 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,9 @@ try { core.setOutput("time", false); const payload = github.context.payload; - const prComments = github.issues.listComments({ + const token = core.getInput('repo-token'); + const octokit = new github.GitHub(token); + const prComments = octokit.issues.listComments({ owner: payload.organization.login, repo: payload.repository.name, issue_numer: payload.pull_request.number From b3c734b8fcff0b76c36761fd7a9f4d9b11144e55 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 11:58:17 -0600 Subject: [PATCH 11/32] test --- index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/index.js b/index.js index bd52c69..4fc2b1c 100644 --- a/index.js +++ b/index.js @@ -14,11 +14,7 @@ try { const payload = github.context.payload; const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); - const prComments = octokit.issues.listComments({ - owner: payload.organization.login, - repo: payload.repository.name, - issue_numer: payload.pull_request.number - }) + const prComments = await octokit.issues.listComments(payload.issue()) console.log(prComments); } catch (error) { From 5a437880a33f35fe3aad2c8367120854efb5929a Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:03:15 -0600 Subject: [PATCH 12/32] test --- index.js | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/index.js b/index.js index 4fc2b1c..0231541 100644 --- a/index.js +++ b/index.js @@ -1,23 +1,27 @@ const core = require('@actions/core'); const github = require('@actions/github'); -try { - // `who-to-greet` input defined in action metadata file - const linkRegEx = core.getInput('link-regex'); - console.log(`Checking for links: ${linkRegEx}!`); - const time = (new Date()).toTimeString(); - - core.setOutput("time", time); - core.setOutput("link", linkRegEx); - core.setOutput("time", false); +async function run() { + try { + // `who-to-greet` input defined in action metadata file + const linkRegEx = core.getInput('link-regex'); + console.log(`Checking for links: ${linkRegEx}!`); + const time = (new Date()).toTimeString(); + + core.setOutput("time", time); + core.setOutput("link", linkRegEx); + core.setOutput("time", false); + + const payload = github.context.payload; + const token = core.getInput('repo-token'); + const octokit = new github.GitHub(token); + const prComments = await octokit.issues.listComments(payload.issue()) + + console.log(prComments); + } catch (error) { + console.log(error); + core.setFailed(error.message); + } +} - const payload = github.context.payload; - const token = core.getInput('repo-token'); - const octokit = new github.GitHub(token); - const prComments = await octokit.issues.listComments(payload.issue()) - - console.log(prComments); -} catch (error) { - console.log(error); - core.setFailed(error.message); -} \ No newline at end of file +run(); From 40027bfc00955c30723f6a2d28286df5615f216e Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:17:55 -0600 Subject: [PATCH 13/32] test --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 0231541..50a4756 100644 --- a/index.js +++ b/index.js @@ -12,10 +12,9 @@ async function run() { core.setOutput("link", linkRegEx); core.setOutput("time", false); - const payload = github.context.payload; const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); - const prComments = await octokit.issues.listComments(payload.issue()) + const prComments = await octokit.issues.listComments(github.context.issue()) console.log(prComments); } catch (error) { From 525a45f16e01c22bbff2f331ee58b463648bc092 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:20:01 -0600 Subject: [PATCH 14/32] test --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 50a4756..6628f55 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,7 @@ async function run() { const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); - const prComments = await octokit.issues.listComments(github.context.issue()) + const prComments = await octokit.issues.listComments(github.context.issue); console.log(prComments); } catch (error) { From 319cbf2f8fab0abf18785c2dc0f6ae4696a7feca Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:31:20 -0600 Subject: [PATCH 15/32] test --- .github/workflows/main.yml | 2 +- action.yml | 2 +- index.js | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba34772..ef34542 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: id: confirm uses: delivered/trello-github-action/@MM-first-pr with: - link-regex: 'https://trello.com' + link-regex: '(https:\/\/trello.com[^\)]*)' repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Get the output time run: echo "The time was ${{ steps.confirm.outputs.time }}. Link ${{steps.confirm.outputs.link}}" diff --git a/action.yml b/action.yml index ad15e25..6cb1905 100644 --- a/action.yml +++ b/action.yml @@ -3,7 +3,7 @@ description: 'Confirm Trello link included on Pull Request' inputs: link-regex: description: 'URL to use reg ex search for' - default: 'https://trello.com' + default: '(https:\/\/trello.com[^\)]*)' outputs: link: description: 'Link that was found' diff --git a/index.js b/index.js index 6628f55..9b75d0e 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,9 @@ const github = require('@actions/github'); async function run() { try { // `who-to-greet` input defined in action metadata file - const linkRegEx = core.getInput('link-regex'); - console.log(`Checking for links: ${linkRegEx}!`); + const linkRegExInput = core.getInput('link-regex'); + const linkRegExp = new RegExp(linkRegExInput) + console.log(`Checking for links: ${linkRegExInput}!`); const time = (new Date()).toTimeString(); core.setOutput("time", time); @@ -16,7 +17,13 @@ async function run() { const octokit = new github.GitHub(token); const prComments = await octokit.issues.listComments(github.context.issue); + const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0) + + console.log('all:') console.log(prComments); + console.log('matches:') + console.log(commentsWithLinks); + } catch (error) { console.log(error); core.setFailed(error.message); From 51b05f39faeff3a9e8c61afd303f33316aae2870 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:32:49 -0600 Subject: [PATCH 16/32] test --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 9b75d0e..a254876 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ async function run() { const time = (new Date()).toTimeString(); core.setOutput("time", time); - core.setOutput("link", linkRegEx); + core.setOutput("link", linkRegExInput); core.setOutput("time", false); const token = core.getInput('repo-token'); From 99f77f0d09590af6fab9a6f9449ffc1e83056492 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:39:41 -0600 Subject: [PATCH 17/32] test --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a254876..3fa2e33 100644 --- a/index.js +++ b/index.js @@ -10,14 +10,14 @@ async function run() { const time = (new Date()).toTimeString(); core.setOutput("time", time); - core.setOutput("link", linkRegExInput); + core.setOutput("link", linkRegEx); core.setOutput("time", false); const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); const prComments = await octokit.issues.listComments(github.context.issue); - const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0) + const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(d.body)[0]) console.log('all:') console.log(prComments); From ebd94ce6efcf984e7f60f600a39b9f367fd303a2 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:44:28 -0600 Subject: [PATCH 18/32] test --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3fa2e33..f22838a 100644 --- a/index.js +++ b/index.js @@ -10,12 +10,17 @@ async function run() { const time = (new Date()).toTimeString(); core.setOutput("time", time); - core.setOutput("link", linkRegEx); + core.setOutput("link", linkRegExp); core.setOutput("time", false); const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); - const prComments = await octokit.issues.listComments(github.context.issue); + const payload = github.context.payload; + const prComments = await octokit.issues.listComments({ + owner: payload.organization.login, + repo: payload.repository.name, + issue_numer: payload.pull_request.number + }); const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(d.body)[0]) From 5e1290b9677a0433133381d58606e2bcee9ac62c Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:48:01 -0600 Subject: [PATCH 19/32] test --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index f22838a..97981be 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,9 @@ async function run() { const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); const payload = github.context.payload; + + console.log(payload); + const prComments = await octokit.issues.listComments({ owner: payload.organization.login, repo: payload.repository.name, From e22c7e2033eb7476c3e1e2fc7b02e554dd9cea88 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:54:02 -0600 Subject: [PATCH 20/32] test --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 97981be..a120508 100644 --- a/index.js +++ b/index.js @@ -17,12 +17,13 @@ async function run() { const octokit = new github.GitHub(token); const payload = github.context.payload; + console.log('payload:'); console.log(payload); const prComments = await octokit.issues.listComments({ owner: payload.organization.login, repo: payload.repository.name, - issue_numer: payload.pull_request.number + issue_number: payload.pull_request.number }); const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(d.body)[0]) From b66dac609802f7716dbc07ec7624ac00953f59c5 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 12:56:00 -0600 Subject: [PATCH 21/32] test --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a120508..6540e44 100644 --- a/index.js +++ b/index.js @@ -26,7 +26,7 @@ async function run() { issue_number: payload.pull_request.number }); - const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(d.body)[0]) + const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(i.body)[0]) console.log('all:') console.log(prComments); From 2f87950af48aea56c221666d7fb6cdcd8a189bf5 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:01:03 -0600 Subject: [PATCH 22/32] test --- action.yml | 8 ++------ index.js | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/action.yml b/action.yml index 6cb1905..fb91da4 100644 --- a/action.yml +++ b/action.yml @@ -5,12 +5,8 @@ inputs: description: 'URL to use reg ex search for' default: '(https:\/\/trello.com[^\)]*)' outputs: - link: - description: 'Link that was found' - found: - description: 'Whether a link was found' - time: # id of output - description: 'The time we greeted you' + msg: + description: 'output of action' runs: using: 'node12' main: 'index.js' \ No newline at end of file diff --git a/index.js b/index.js index 6540e44..f7690bb 100644 --- a/index.js +++ b/index.js @@ -6,20 +6,14 @@ async function run() { // `who-to-greet` input defined in action metadata file const linkRegExInput = core.getInput('link-regex'); const linkRegExp = new RegExp(linkRegExInput) + console.log(`Checking for links: ${linkRegExInput}!`); - const time = (new Date()).toTimeString(); - - core.setOutput("time", time); - core.setOutput("link", linkRegExp); - core.setOutput("time", false); - + + const time = (new Date()).toTimeString(); const token = core.getInput('repo-token'); const octokit = new github.GitHub(token); const payload = github.context.payload; - console.log('payload:'); - console.log(payload); - const prComments = await octokit.issues.listComments({ owner: payload.organization.login, repo: payload.repository.name, @@ -28,12 +22,18 @@ async function run() { const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(i.body)[0]) - console.log('all:') - console.log(prComments); + console.log('all prComments:') + console.log(prComments.data.map(i => i.body)); + console.log('matches:') console.log(commentsWithLinks); - } catch (error) { + core.setOutput('msg', `Found ${commentsWithLinks.length} with matching links`) + + if(commentsWithLinks.length === 0) + core.setFailed(`unable to find any comments matching link ${linkRegExInput}`) + + } catch (error) { console.log(error); core.setFailed(error.message); } From 7a4ff5e44c5f34ac57ec8b207ee79948afa62558 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:03:53 -0600 Subject: [PATCH 23/32] test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ef34542..21c4420 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ on: [pull_request] jobs: confirm-link: runs-on: ubuntu-latest - name: This action will look for a link matching a regEx (eg, http://trello.com) in Pull Request. + name: Ensure Trello link present as attachment. steps: - name: Confirm Link id: confirm From 05be3ca1845940411797c53e88f97646660e0fb6 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:04:49 -0600 Subject: [PATCH 24/32] test --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 21c4420..2362df7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,4 @@ jobs: uses: delivered/trello-github-action/@MM-first-pr with: link-regex: '(https:\/\/trello.com[^\)]*)' - repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Get the output time - run: echo "The time was ${{ steps.confirm.outputs.time }}. Link ${{steps.confirm.outputs.link}}" + repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 18bb8e684b01abffff976249654112187c205f46 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:07:47 -0600 Subject: [PATCH 25/32] test --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2362df7..7756efe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,6 @@ -on: [pull_request] - +on: + pull_request: + types: [created, edited] jobs: confirm-link: runs-on: ubuntu-latest From dd3b3d051c65d848a4abc5db101d29f8732407d6 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:09:43 -0600 Subject: [PATCH 26/32] test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7756efe..b7a7ed4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ on: pull_request: - types: [created, edited] + types: [created, issue_comment, edited] jobs: confirm-link: runs-on: ubuntu-latest From f0e90380c212b6bc55057173dc90878818a418fc Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:10:56 -0600 Subject: [PATCH 27/32] test --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b7a7ed4..c8e5727 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ on: pull_request: - types: [created, issue_comment, edited] + types: [created, issue_comment, edited, opened, synchronize, reopened] jobs: confirm-link: runs-on: ubuntu-latest From 46616fef865d68daff689ded6faa5e8aa655e6cd Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:12:14 -0600 Subject: [PATCH 28/32] improving regex --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index f7690bb..693ae93 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ async function run() { issue_number: payload.pull_request.number }); - const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(i.body)[0]) + const commentsWithLinks = prComments.data.filter(d => linkRegExp.exec(d.body) && linkRegExp.exec(d.body).length > 0).map(i => linkRegExp.exec(i.body)[0]) console.log('all prComments:') console.log(prComments.data.map(i => i.body)); From e44c426576acad8a9d196efa48d9145201668078 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:17:30 -0600 Subject: [PATCH 29/32] comment trigger? --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8e5727..4bcaec3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,8 @@ on: pull_request: - types: [created, issue_comment, edited, opened, synchronize, reopened] + types: [created, edited, opened, synchronize, reopened] + issue_comment: + types: [created, edited, deleted] jobs: confirm-link: runs-on: ubuntu-latest From cba3ffef94dbe4dbea0d55457c9c468478a21eaf Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Wed, 15 Jan 2020 13:24:07 -0600 Subject: [PATCH 30/32] responding to issues event --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4bcaec3..5aac516 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,6 +3,8 @@ on: types: [created, edited, opened, synchronize, reopened] issue_comment: types: [created, edited, deleted] + issues: + types: [created, edited, deleted] jobs: confirm-link: runs-on: ubuntu-latest From 2b4b375c6459f0632f2b8bf7215d81bc33a65890 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Sat, 18 Jan 2020 08:41:05 -0600 Subject: [PATCH 31/32] include issue comment --- .github/workflows/main.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5aac516..1691762 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,8 @@ on: pull_request: - types: [created, edited, opened, synchronize, reopened] + types: [edited, opened, synchronize, reopened] issue_comment: - types: [created, edited, deleted] - issues: - types: [created, edited, deleted] + types: [created, edited] jobs: confirm-link: runs-on: ubuntu-latest From b0a9c579c335f012aae91720f44eb78c1a912bd7 Mon Sep 17 00:00:00 2001 From: Marty Mavis Date: Sat, 18 Jan 2020 08:42:58 -0600 Subject: [PATCH 32/32] switching order --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1691762..2b9ad3b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,8 +1,8 @@ on: - pull_request: - types: [edited, opened, synchronize, reopened] issue_comment: types: [created, edited] + pull_request: + types: [edited, opened, synchronize, reopened] jobs: confirm-link: runs-on: ubuntu-latest