Getting Started
The GitHub Flow is a lightweight, branch-based for projects with regular deployments.
As the workflow above, we just touch only 2 branches; master(Currently is main branch) and feature branch (own branch for develop).
Step of Github flow work
- Clone resources from main branch and checkout to feature branch (your own branch).
- Edit, change or fix the code in resources on your own branch then commit.
- Push to the original branch.
- Open pull request and tag reviewer to review your code.
- When reviewing finish, the reviewer will merge the code to main branch.
Example
A complete example demonstrating a Feature Branch Flow is as follows. Assuming we have a repo setup with a main branch.
git checkout main git checkout -b <feature_branch>
So, the work happens on feature branch (edit, change, fix the code)
git add .
git commit -m <commit message>
git push origin <feature_branch>
git request-pull main ./
Github action is the best way for supercharge the Github workflow using event-driven design. It’s fully built-in in the Github that’s responsible to automate, customize, and execute your software development workflows in your repository likes the CI/CD pipeline.
Basic concepts of Github Action
Here’s the prove concept of Github action integrate with the workflow.
- Workflows: Every repository contain workflow (one or more workflows) that were defined be separate YAML file in .github/workflows directory of the repo and each workflows can run parallel at the same time. As following as workflow syntax
- Event: A workflows will trigger if we create one or more events that consist of internal Github event such as a pull request, a release or a push, a schedule event likes a cron job or external event that triggered be Webhook or API.
- Jobs: A workflow can have one or more jobs that contains a set of commands and then run when the workflow is triggered. Jobs can run parallel. Also can define run sequentially when we have dependencies between jobs.
- Runner: Each job runs on a specific runner. A runner is virtual machine hosted by Github with an operating system (Linux, MacOS or Window). You can choose them and also use self-hosted runner.
- Steps: A sequence of steps are under a job that are either shell command or action. All the steps of a job run sequentially on runner.
- Actions: An action is reusable unit of code which can be included as a step of a job.
P.S. for example of Github action workflow, can see in the reference guide below.