website
website copied to clipboard
GHA add comments to prework issue 4820
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
, orclosed as not planned
- Updated
issue-trigger.yml
file with new jobAdd-Comment-To-Prework-Issue
- Updated
- issue_comment:
created
- Created
issue-comment-trigger.yaml
file and created new jobAdd-Comment-To-Prework-Issue
- Created
- pull_request:
opened
,closed
- Updated
pull-request-trigger.yaml
file with new jobAdd-Comment-To-Prework-Issue
- Updated
- pull_request_review:
submitted
- Created
pull-request-review-trigger.yaml
file and created new jobAdd-Comment-To-Prework-Issue
- Created
- pull_request_review_comment:
created
- Created
pull-request-review-comment-trigger.yaml
file and created new jobAdd-Comment-To-Prework-Issue
- Created
- issues:
-
Created
prework-issue-reusable-workflow
folder ingithub-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
- Created
- Search for an issue with a "prework" label that is assigned to the contributor
- Created
get-prework-issue.js
andget-issue-by-label.js
- Created
- If the prework issue is closed, reopen it
- Created
update-prework-issue-status.js
andreopen-issue.js
- Created
- If the above issue is reopened, move it in the "In Progress" column
- Created
update-issue-project-card.js
- Created
- Add a comment to the prework issue describing the event/activity
- Created
add-prework-issue-comment.js
- Created
- Determine the contributor generating the event/activity:
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 thegithub-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
}
}
}
}
}
}