website icon indicating copy to clipboard operation
website copied to clipboard

GHA add comments to prework issue 4820

Open partapparam opened this issue 9 months ago • 6 comments

Fixes #4820

What changes did you make?

  • The following event/activity types are set up to trigger the workflow

    • issues: opened, assigned, unassigned, closed as completed, or closed as not planned
      • Updated issue-trigger.yml file with new job Add-Comment-To-Prework-Issue
    • issue_comment: created
      • Created issue-comment-trigger.yaml file and created new job Add-Comment-To-Prework-Issue
    • pull_request: opened, closed
      • Updated pull-request-trigger.yaml file with new job Add-Comment-To-Prework-Issue
    • pull_request_review: submitted
      • Created pull-request-review-trigger.yaml file and created new job Add-Comment-To-Prework-Issue
    • pull_request_review_comment: created
      • Created pull-request-review-comment-trigger.yaml file and created new job Add-Comment-To-Prework-Issue
  • Created prework-issue-reusable-workflow folder in github-actions

  • Added files to github-actions/utils folder

  • Created prework-issue-comment-reusable-workflow.yaml with the following steps:

    • Determine the contributor generating the event/activity:
      • Created get-activity-detail.js
    • Search for an issue with a "prework" label that is assigned to the contributor
      • Created get-prework-issue.js and get-issue-by-label.js
    • If the prework issue is closed, reopen it
      • Created update-prework-issue-status.js and reopen-issue.js
    • If the above issue is reopened, move it in the "In Progress" column
      • Created update-issue-project-card.js
    • Add a comment to the prework issue describing the event/activity
      • Created add-prework-issue-comment.js

Why did you make the changes (we will use this info to test)?

  • To create a GitHub Action that will be triggered by GitHub issue, issue_comment, pull_request, pull_request_review and pull_request_review_comment events and will post comments to the developer's pre-work issue describing the developer's activities.

Notes

  • Folder structure
    • I tried to follow the HFLA Github Actions guide with creating the new folders
    • The new triggers call a Reusable Workflow, all jobs to accomplish the required work are in this workflow.
    • The files required by the prework-issue-comment-reusable-workflow.yaml are located in the github-actions/prework-issue-reusable-workflow folder
  • For testing purposes, I added permissions: issues: write but I believe this is not required in this repo. I can remove once tested by the reviewer.
  • HFLA Project Board (number: 7) - In Progress Column value is hard coded.
    • I decided to provide the ProjectCardId rather than use an additional step to query the API.
    • For testing, you will need to update the ProjectCardId to your local project board and use the below query to fetch from the GraphQL API.
query{
   repository(owner: "hackforla", name: "website") {
     projects(first: 10) {
       nodes {
         name
         number
         id
         columns(first: 10) {
           __typename
           nodes {
             name
             id
           }
         }
       }
     }
   }
 }

partapparam avatar May 21 '24 18:05 partapparam