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
Makes everyone fail the pre-commit checks in the morning session (MetOffice#72)
* Makes everyone fail the pre-commit checks in the morning session
* Fix image links and delete JPEGs
---------
Co-authored-by: Ronnie Dutta <[email protected]>
Copy file name to clipboardExpand all lines: episodes/01-issues.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ Here's some advice for writing good Issues:
32
32
- Break up large Issues into several small ones and or
33
33
use checklists to track tasks in the Issue
34
34
35
-
Open an Issue on the `git-training-demo` repository
35
+
Open an Issue on the `git-training-demo` repository
36
36
to add a file stating your favourite cloud type.
37
37
38
38
Navigate to the **Issues** tab:
@@ -46,7 +46,7 @@ to provide templates for bugs and feature requests.
46
46
Click on the green **Get started** button next to the
47
47
**Feature request** option:
48
48
49
-
{alt='A screenshot of the git-training-demo repository showing an Issue being opened. The template has automatically added text to the description and labelled the Issue as an enhancement.'}
49
+
{alt='A screenshot of the git-training-demo repository showing an Issue being opened. The template has automatically added text to the description and labelled the Issue as an enhancement.'}
50
50
51
51
You can see the Issue has text in the description already.
52
52
This is from the template which provides a consistent
@@ -93,7 +93,7 @@ On the right hand side of the Issue you can:
93
93
you are working on it.
94
94
2. Add the Issue to a Project by clicking on the cog
95
95
next to the Projects section. (If you don't see a project
96
-
related to the training you might not have been granted permissions,
96
+
related to the training you might not have been granted permissions,
@@ -277,7 +285,7 @@ In the description scroll down to the checklists
277
285
which look like this:
278
286
279
287
```md
280
-
- [ ] I have read `CONTRIBUTING.md` and added my name as a Code Contributor.
288
+
- [ ] I have read `CONTRIBUTING.md`.
281
289
```
282
290
283
291
Some open source projects require you to add your name
@@ -287,45 +295,33 @@ Replace the space in the square checkbox brackets with an `x`
287
295
to mark the task as complete:
288
296
289
297
```md
290
-
- [x] I have read `CONTRIBUTING.md` and added my name as a Code Contributor.
298
+
- [x] I have read `CONTRIBUTING.md`.
291
299
```
292
300
293
301
Now when you open the PR it should look something like this:
294
302
295
-
{alt='A screenshot of a users pull request from their fork back to the upstream git-training-demo repository.'}
303
+
{alt='A screenshot of a users pull request from their fork back to the upstream git-training-demo repository.'}
296
304
297
-
This image shows PR number `#8`.
298
-
This PR will close/fix Issue number `#7` (the top left arrow).
305
+
This image shows PR number `#2`.
306
+
This PR will close/fix Issue number `#1` (the top left arrow).
299
307
You can request a review on the top right.
300
308
Some repositories will be set up to automatically assign
301
309
a reviewer based on how many reviews each team member
302
310
currently has open[^auto-assign-pr-review].
311
+
The middle arrow is where you assign yourself to the PR.
303
312
The bottom arrow shows the checklist items we marked as complete.
304
313
305
314
At the bottom of your PR you can see that a review is required
306
-
before merging.
307
-
All checks have passed, this repository has automatic checks
315
+
before merging and some checks were not successful.
316
+
This repository has automatic checks
308
317
for trailing whitespace, accidentally adding large files etc.
309
-
More information can be found in the optional episode on
318
+
More information on setting up these checks
319
+
can be found in the optional episode on
310
320
[pre-commit hooks](./09-pre-commit.md).
311
321
312
-
::: caution
313
-
314
-
## Help: Some checks have failed
315
-
316
-
If your now open Pull Request says some checks have failed
317
-
this is because your changes did not pass the automatic
318
-
pre-commit checks.
319
-
320
-
Click on the **Details** link next to the failed test
321
-
and fix your code on your local repository.
322
-
Commit and then push this fix to GitHub.
323
-
Your PR will automatically update and re-run the tests,
324
-
you may need to refresh the page.
322
+
::: callout
325
323
326
-
:::
327
-
328
-
### Automatically closing Issues via PRs
324
+
## Automatically closing Issues via PRs
329
325
330
326
A PR can automatically close an Issue when it is merged into `main`.
331
327
To use this GitHub functionality
@@ -345,8 +341,61 @@ Make sure you change `1` to your Issue number.
345
341
The [GitHub Documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue) has more information
346
342
on linking PRs to Issues.
347
343
344
+
:::
345
+
346
+
## Fixing Failing Checks
347
+
348
+
Your changes did not pass the automatic pre-commit checks.
349
+
The quickest way to check why a test failed is to click on
350
+
the **Pull request checks / pre-commit** link near the bottom
351
+
of the PR.
352
+
Or you can navigate to the **Checks** tab in the PR,
353
+
then select **Pull request checks** and click on the failing test.
354
+
355
+
{alt='A screenshot of a users failing pre-commit check showing the whitespace test has failed.'}
356
+
357
+
You can see in the test output trailing whitespace has been found.
358
+
This caused the tests to fail.
359
+
Lower down in the output you will see the filename,
360
+
and a diff of the line with the whitespace.
361
+
362
+
Go back to your local repository and remove the whitespace:
363
+
364
+
```bash
365
+
$ nano cloud-mo-fitzroy.md
366
+
$ cat cloud-mo-fitzroy.md
367
+
```
368
+
369
+
```output
370
+
# My Favourite Cloud
371
+
372
+
Light and fluffy cumulus.
373
+
```
374
+
375
+
Add and commit your changes:
376
+
377
+
```bash
378
+
$ git add cloud-mo-fitzroy.md
379
+
$ git commit -m "Removes whitespace"
380
+
```
381
+
382
+
```output
383
+
[1_favourite_cloud c74c7e1] Removes whitespace
384
+
1 file changed, 1 insertion(+), 1 deletion(-)
385
+
```
386
+
387
+
Push these changes to GitHub:
388
+
389
+
```bash
390
+
$ git push
391
+
```
392
+
393
+
Navigate back to your PR.
394
+
You should now see a message saying all checks have passed.
395
+
Merging is still blocked until a colleague reviews our code.
396
+
348
397
In the next episode we will look at how these changes
349
-
are reviewed and merged back into `main` in more detail.
398
+
are reviewed and merged back into `main`.
350
399
351
400
::::::::::::::::::::::::::::::::::::::: challenge
352
401
@@ -361,7 +410,7 @@ On the right hand side of the PR you can also:
361
410
2. Add labels to the PR.
362
411
3. Add the PR to a Project by clicking on the cog
363
412
next to the Projects section. (If you don't see a project
364
-
related to the training you might not have been granted permissions,
413
+
related to the training you might not have been granted permissions,
branch '2_update_favourite_cloud' set up to track 'origin/2_update_favourite_cloud'.
@@ -173,7 +173,7 @@ from a Fork[^link-pr-issue].
173
173
[^link-pr-issue]: The [GitHub Documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue) has more information
174
174
on linking PRs to Issues.
175
175
176
-
{alt='A screenshot of a user opening a pull request from their fork back to the upstream git-training-demo repository. The description has been autofilled with the pull request template contents.'}
176
+
{alt='A screenshot of a user opening a pull request from their fork back to the upstream git-training-demo repository. The description has been autofilled with the pull request template contents.'}
177
177
178
178
The PR will now need to be approved and merged by your instructors.
179
179
@@ -339,7 +339,7 @@ sequenceDiagram
339
339
- A fork is a server side, in our case GitHub, copy
340
340
of the repository.
341
341
- Forks allow collaborators to contribute to the main
0 commit comments