-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A custom workflow #6
Conversation
Choose the eventGreat job creating a new workflow! As we briefly discussed earlier, workflows can be configured to run:
Full details are available in Events that trigger workflows on GitHub Help. So far, we've used the For a review workflow, we want to engage with human reviews, instead. For example, we'll use the Label approved pull requests action so that we can easily see when we've gotten enough reviews to merge a pull request. Let's prep our review workflow by triggering it with a |
@@ -0,0 +1 @@ | |||
name: Team awesome's approval workflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 15: Use an action to automate pull request reviews
Trigger your review workflow. Apply the suggestion or follow the instructions to do it directly.
⌨️ Activity: Use the community action in your new workflow
name: Team awesome's approval workflow | |
name: Team awesome's approval workflow | |
on: pull_request_review |
- Edit your newly created workflow file
- Below the title, run the workflow on a pull request review event:
on: pull_request_review
- Commit your changes to this branch
I'll respond when you commit something to this branch.
Add a jobGreat work! Let's get some more practice with jobs. Apply the suggested change below or follow the instructions. In a later step, we'll use an action that adds a label to any pull requests after a preset number of approvals. These labels could be used as a visual indicator to your team that something is ready to merge, or even as a way to use other actions or tools to automatically merge pull requests when they receive the required number of approvals. |
Co-authored-by: github-learning-lab[bot] <37936606+github-learning-lab[bot]@users.noreply.github.com>
Add a stepWe've now got a job with the It's now time to use a community-created action. The action we'll use is pullreminders/label-when-approved-action. Step 17: Automate approvalsLet's see if you can use this action on your own. If you'd like a hint, submit a comment on this pull request with the word "hint". Here's some tips to get you going:
⌨️ Activity: Use the community action to automate part of the review approval process
I'll respond when you push a new commit to this branch. |
Our workflowAwesome! We can now check an additional requirement off our list!
We'll now use branch protections in combination with this change so that everything goes smoothly. Up until now, I've handled branch protections for you, but I've removed them so that you can learn how to set them. Take a look at the merge box, you'll notice you can merge this even though the review process hasn't been met. Still see the protection? Refresh this page. Step 18: Use branch protectionsProtected branches ensure that collaborators on your repository cannot make irrevocable changes to branches. Enabling protected branches also allows you to enable other optional checks and requirements, like required status checks and required reviews. Next, add branch protections and continue with the course. ⌨️ Activity: Complete the automated review process by protecting the master branch
I'll respond when I receive an approval from your pull request review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
Completed workflowsAwesome work! Our workflows are now complete. GitHub Actions will apply a label to this pull request because you've approved it. This may take a few moments to run, you can follow along in the Actions tab. Labeling the pull request allows us to automate the merging of pull requests. I'll act as the 🤖 automation in this example and merge the pull request for you. |
Let's go to the next step. |
Partial workflow
Remember the custom workflow we are attempting to create for the team? Here's our status on the list of requirements we defined:
master
branch can't be deleted or inadvertently brokenThe last three remaining items don't really belong in a
code, build, and test
pipeline because they have to do with processes that involve humans.Step 14: Automate the review process
GitHub Actions can run multiple workflows for different event triggers. Let's create a new approval workflow that'll work together with our Node.js workflow.
⌨️ Activity: Add a new workflow file to automate the team's review process
.github/workflows/approval-workflow.yml
, on this branchI'll respond when you commit to this branch.