You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/guided-workshop/exercises/6-github-flow.md
+20-12Lines changed: 20 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,61 +25,69 @@ There are different ways to create a branch when using [GitHub Codespaces](https
25
25
26
26
1. Return to your codespace, or reopen it by navigating to your repository and selecting **Code** > **Codespaces** and the name of your codespace.
27
27
1. Open a **terminal window** by pressing <kbd>Ctl</kbd> + <kbd>`</kbd>.
28
-
1. In the terminal window, enter the following command to create and switch to a new branch named `add-hours` and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac)::
28
+
1. In the terminal window, enter the following command to create and switch to a new branch named `add-hours`:
29
29
30
30
```bash
31
31
git checkout -b add-hours
32
32
```
33
33
34
-
1. Stage all code to be committed to the new branch by entering the following commandin the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
34
+
1. Stage all code to be committed to the new branch by entering the following commandin the terminal window:
35
35
36
36
```bash
37
37
git add .
38
38
```
39
39
40
-
1. Commit all changes with a message describing what's been updated by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
40
+
1. Commit all changes with a message describing what's been updated by entering the following command in the terminal window:
41
41
42
42
```bash
43
43
git commit -m "Added hours component"
44
44
```
45
45
46
-
1. Finally, push the new branch to the repository by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
46
+
1. Finally, push the new branch to the repository by entering the following command in the terminal window:
47
47
48
48
```bash
49
49
git push -u origin add-hours
50
50
```
51
51
52
-
## Create the pull request
52
+
## Create the pull request to suggest updates
53
53
54
54
A [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) is a request to pull or incorporate new code into the existing codebase. When a pull request is made it's customary to have other team members review the code and make comments, and for[CI/CD](https://resources.github.com/ci-cd/) processes to run. Once everything is completed and the code isin a stage where everyone has signed-off, it's then merged into the codebase.
55
55
56
56
Pull requests can be made through the source control pane in the codespace, the repository's website, or through the command-line using the [GitHub CLI](https://cli.github.com/). In our example we're going to create the pull request in the CLI, then navigate to the website to see the pull request and the actions running, and merge the code into the codebase.
57
57
58
58
1. Return to your codespace.
59
-
1. Find the number for the [issue you created earlier](./2-issues.md) titled **Add component to display hours** by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
59
+
1. Find the number for the [issue you created earlier](./2-issues.md) titled **Add component to display hours** by entering the following command in the terminal window:
60
60
61
61
```bash
62
62
gh issue list
63
63
```
64
64
65
-
1. Create a pull request with the title **Add hours component** and body **Resolves #\<ISSUE_NUMBER\>**, replacing **\<ISSUE_NUMBER\>** with the issue number you obtained in the previous step by entering the following command in the terminal window and pressing <kbd>Enter</kbd> (or <kbd>Return</kbd> on a Mac):
65
+
1. Create a pull request with the title **Add hours component** and body **Resolves #\<ISSUE_NUMBER\>**, replacing **\<ISSUE_NUMBER\>** with the issue number you obtained in the previous step by entering the following command in the terminal window:
When the pull request is created, you will see a link appear to the page for the pull request. From there you can add comments, see any workflows running, and decide to close or merge the pull request. Let's ensure the tests now run successfully and, assuming they do, merge the pull request.
73
+
When the pull request is created, you will see a link appear to the page for the pull request. From there you can add comments, see any workflows running, and decide to close or merge the pull request. You can also see any workflows associated with the pull request run.
74
+
75
+
In our scenario, we created an automated workflow for front-end tests for our application, which runs whenever a push or pull request is made to `main`. We also enabled [code scanning](../exercises/1-code-scanning.md), which was set to run on the same triggers. We've just created a pull request, which will cause both of those workflows to run!
76
+
77
+
Let's explore the pull request and watch the workflows run. We'll ensure the tests now run successfully and, assuming they do, merge the pull request.
74
78
75
79
1. Follow the link displayed in the terminal window by using <kbd>Ctl</kbd> - **Click** (or <kbd>Cmd</kbd> - **Click** on a Mac).
76
-
1. In the page displayed, note the workflow running the [end-to-end tests created earlier](./4-testing.md).
77
-
1. When the test passes successfully, select**Merge pull request** to merge your changes into the **main** branch.
80
+
1. In the page displayed, note the workflow running the [end-to-end tests created earlier](./4-testing.md) and [code scanning](../exercises/1-code-scanning.md).
81
+
1. When the workflows complete successfully, select**Merge pull request** to merge your changes into the **main** branch.
78
82
79
83
Congratulations! You've now used the GitHub flow to suggest changes, perform a review, and merge those into your codebase.
80
84
81
85
## Summary and next steps
82
86
83
87
The GitHub flow is a workflow for managing changes and incorporating new features into a codebase. GitHub flow gives you the freedom to explore and experiment, while ensuring all code follows a validation process before being merged. With the code updated, it's time to deploy the project! The first step is to [create the deployment environment](./7-create-environment.md).
0 commit comments