From ac69b96384604620805332e3a9cb6eb4c5be0ed8 Mon Sep 17 00:00:00 2001 From: Eileen Burdekin Date: Sat, 22 Jun 2024 17:48:32 -0700 Subject: [PATCH 1/5] update comment to tag latest assignee instead --- .github/workflows/isssue-assigned.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/isssue-assigned.yml b/.github/workflows/isssue-assigned.yml index 35e2ef21..fbf2d401 100644 --- a/.github/workflows/isssue-assigned.yml +++ b/.github/workflows/isssue-assigned.yml @@ -14,9 +14,10 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const assignee = `@${context.payload.issue.assignees[0].login}`; + const assignees = context.payload.issue.assignees; + const latestAssignee = `@${assignees[assignees.length - 1].login}`; - const commentBody = `Hey ${assignee}! Thanks for taking this issue. + const commentBody = `Hey ${latestAssignee}! Thanks for taking this issue. To help keep everyone in the loop, please comment your Estimated Time to Completion (ETC) below! From d7784b683f1f83f83a9b8656d88e978fdd0119f9 Mon Sep 17 00:00:00 2001 From: Eileen Burdekin Date: Sat, 22 Jun 2024 17:48:59 -0700 Subject: [PATCH 2/5] fix typo in yml filename --- .github/workflows/issue-assigned.yml | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/issue-assigned.yml diff --git a/.github/workflows/issue-assigned.yml b/.github/workflows/issue-assigned.yml new file mode 100644 index 00000000..fbf2d401 --- /dev/null +++ b/.github/workflows/issue-assigned.yml @@ -0,0 +1,32 @@ +name: Issue Assignment Comment + +on: + issues: + types: [assigned] + +jobs: + issue-assignment-comment: + runs-on: ubuntu-latest + + steps: + - name: Issue assignment comment + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const assignees = context.payload.issue.assignees; + const latestAssignee = `@${assignees[assignees.length - 1].login}`; + + const commentBody = `Hey ${latestAssignee}! Thanks for taking this issue. + + To help keep everyone in the loop, please comment your Estimated Time to Completion (ETC) below! + + Thanks again! + `; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: commentBody, + }); From 67a598265baa3cac33e281ec1731d417142362e9 Mon Sep 17 00:00:00 2001 From: Eileen Burdekin Date: Sat, 22 Jun 2024 17:50:32 -0700 Subject: [PATCH 3/5] rm file with typo --- .github/workflows/isssue-assigned.yml | 32 --------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/isssue-assigned.yml diff --git a/.github/workflows/isssue-assigned.yml b/.github/workflows/isssue-assigned.yml deleted file mode 100644 index fbf2d401..00000000 --- a/.github/workflows/isssue-assigned.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Issue Assignment Comment - -on: - issues: - types: [assigned] - -jobs: - issue-assignment-comment: - runs-on: ubuntu-latest - - steps: - - name: Issue assignment comment - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const assignees = context.payload.issue.assignees; - const latestAssignee = `@${assignees[assignees.length - 1].login}`; - - const commentBody = `Hey ${latestAssignee}! Thanks for taking this issue. - - To help keep everyone in the loop, please comment your Estimated Time to Completion (ETC) below! - - Thanks again! - `; - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: commentBody, - }); From cf16925fc1318796f071a37539feb7591d19559d Mon Sep 17 00:00:00 2001 From: Eileen Burdekin Date: Sat, 22 Jun 2024 17:57:42 -0700 Subject: [PATCH 4/5] loop through all assignees instead --- .github/workflows/issue-assigned.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/issue-assigned.yml b/.github/workflows/issue-assigned.yml index fbf2d401..637e916d 100644 --- a/.github/workflows/issue-assigned.yml +++ b/.github/workflows/issue-assigned.yml @@ -15,14 +15,16 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const assignees = context.payload.issue.assignees; - const latestAssignee = `@${assignees[assignees.length - 1].login}`; - const commentBody = `Hey ${latestAssignee}! Thanks for taking this issue. + for (const assignee of assignees) { + const assigneeUsername = `@${assignee.login}`; - To help keep everyone in the loop, please comment your Estimated Time to Completion (ETC) below! + const commentBody = `Hey ${assigneeUsername}! Thanks for taking this issue. - Thanks again! - `; + To help keep everyone in the loop, please comment your Estimated Time to Completion (ETC) below! + + Thanks again! + `; await github.rest.issues.createComment({ owner: context.repo.owner, From a1f1ce6bff21136b4bdafc43101cfa7843e043d0 Mon Sep 17 00:00:00 2001 From: Eileen Burdekin Date: Sat, 22 Jun 2024 23:18:08 -0700 Subject: [PATCH 5/5] add missing closing brace --- .github/workflows/issue-assigned.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/issue-assigned.yml b/.github/workflows/issue-assigned.yml index 637e916d..72ecf7d9 100644 --- a/.github/workflows/issue-assigned.yml +++ b/.github/workflows/issue-assigned.yml @@ -26,9 +26,10 @@ jobs: Thanks again! `; - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: commentBody, - }); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: commentBody, + }); + }