From a0268346355649d30cd963fa784ac5140b8284ab Mon Sep 17 00:00:00 2001 From: Matthew Griffin Date: Tue, 18 Jun 2024 10:55:51 +0100 Subject: [PATCH 1/3] [skip ci] Update Readme so information about preferred clone process is up front --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 467aa4f1..fb90b84b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,16 @@ The tech carbon estimator is a web component that allow you to estimate, at high level, your carbon emissions +## Cloning the project + +When cloning the project on a Windows machine, it is recommended to add the following option: + +``` +git clone REPOSITORY_URL --config core.autocrlf=input +``` + +For more information on why this is necessary, see the section on [Line Endings](#line-endings) + ## Using component exposed as a web component `tech-carbon-estimator`. The component takes the follow optional input: @@ -52,7 +62,7 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C ## Line endings -This project is configured to use Linux/macOS line endings (Line Feed or LF), which will be enforced by prettier. If working on Windows, your editor should be configured to insert these kind of line endings (the default for VSCode using the repo settings). To prevent git from attempting to change line endings when pulling down changes you should set the following config option: +This project is configured to use Linux/macOS line endings (Line Feed or LF), which will be enforced by Prettier. If working on Windows, your editor should be configured to insert these kind of line endings (the default for VSCode using the repo settings). To prevent git from attempting to change line endings when pulling down changes you should set the following config option: ``` git config core.autocrlf input @@ -64,7 +74,7 @@ This option can also be set when cloning the repository by running: git clone REPOSITORY_URL --config core.autocrlf=input ``` -Applying the setting when cloning rather than after cloning may help resolve issues related to line endings when setting up the project in VSCode. +Applying the setting when cloning rather than after cloning may help resolve issues related to line endings when setting up the project in VSCode. Otherwise the default behaviour of git is to convert the line endings to the Windows standard of CRLF as you pull down the code and convert them back again on push. As Prettier can only use one standard, this then results in every line ending in the project being marked as an error within VSCode. ## Documentation From 55ee02d6bf5dc84f6a82bd59ca299fd9cecc3e62 Mon Sep 17 00:00:00 2001 From: Matthew Griffin Date: Wed, 19 Jun 2024 11:09:57 +0100 Subject: [PATCH 2/3] Add information around the issues that can occur with Pull Requests that skip ci runs --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb90b84b..75301f2e 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,13 @@ Run `ng build` to build the project. The build artifacts will be stored in the ` Run `ng test` to execute the unit tests via [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/). -## GitHub Actions +## Pull Requests / GitHub Actions -The project uses [GitHub Actions](https://docs.github.com/en/actions) to automate certain workflows. One such workflow runs when opening a pull request and pushing changes to the related branch. If you would like to skip running the workflow for a given push to a PR branch there are [various ways](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs) this can be achieved. For example, adding `[skip ci]` to the end of the commit message in the push (e.g. `git commit -m "My message [skip ci]"`) will skip running the workflow for that push. +The project uses [GitHub Actions](https://docs.github.com/en/actions) to automate certain workflows. One such workflow runs when opening a pull request and pushing changes to the related branch. The main branch also has a branch protection rule that ensures that the status checks from this workflow have passed successfully before PRs can be merged into it. + +If you would like to skip running the workflow for a given push to a PR branch there are [various ways](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs) this can be achieved. For example, adding `[skip ci]` to the end of the commit message in the push (e.g. `git commit -m "My message [skip ci]"`) will skip running the workflow for that push. However, you should be aware that this will also mark the status checks in the PR as pending, which will still block it from being merged. + +Unfortunately Github does not recognise manually triggered runs of this workflow, so if you end up in this state you will either need to push additional changes without `[skip ci]` or amend the original commit to remove it from the description (e.g. `git commit --amend -m "My message"`), and then force push the branch (`git push --force` - not recommended if anyone else has pulled down the branch), if there are no more legitimate changes to make. ## Further help From 450b1eeabfa1274a849f898738440202c26ad998 Mon Sep 17 00:00:00 2001 From: Matthew Griffin Date: Wed, 19 Jun 2024 16:06:10 +0100 Subject: [PATCH 3/3] Change recommended force command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75301f2e..0fa17c65 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The project uses [GitHub Actions](https://docs.github.com/en/actions) to automat If you would like to skip running the workflow for a given push to a PR branch there are [various ways](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs) this can be achieved. For example, adding `[skip ci]` to the end of the commit message in the push (e.g. `git commit -m "My message [skip ci]"`) will skip running the workflow for that push. However, you should be aware that this will also mark the status checks in the PR as pending, which will still block it from being merged. -Unfortunately Github does not recognise manually triggered runs of this workflow, so if you end up in this state you will either need to push additional changes without `[skip ci]` or amend the original commit to remove it from the description (e.g. `git commit --amend -m "My message"`), and then force push the branch (`git push --force` - not recommended if anyone else has pulled down the branch), if there are no more legitimate changes to make. +Unfortunately Github does not recognise manually triggered runs of this workflow, so if you end up in this state you will either need to push additional changes without `[skip ci]` or amend the original commit to remove it from the description (e.g. `git commit --amend -m "My message"`), and then force push the branch (`git push --force-with-lease` - not recommended if anyone else has pulled down the branch), if there are no more legitimate changes to make. ## Further help