Skip to content
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

Add empty pre-commit config #10

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ R console:

```r
# Install/Update sandpaper
options(repos = c(carpentries = "https://carpentries.r-universe.dev/",
options(repos = c(carpentries = "https://carpentries.r-universe.dev/",
CRAN = "https://cloud.r-project.org"))
install.packages("sandpaper")

Expand Down Expand Up @@ -42,13 +42,13 @@ This workflow does the following:

#### Caching

This workflow has two caches; one cache is for the lesson infrastructure and
This workflow has two caches; one cache is for the lesson infrastructure and
the other is for the the lesson dependencies if the lesson contains rendered
content. These caches are invalidated by new versions of the infrastructure and
the `renv.lock` file, respectively. If there is a problem with the cache,
the `renv.lock` file, respectively. If there is a problem with the cache,
manual invaliation is necessary. You will need maintain access to the repository
and you can either go to the actions tab and [click on the caches button to find
and invalidate the failing cache](https://github.blog/changelog/2022-10-20-manage-caches-in-your-actions-workflows-from-web-interface/)
and invalidate the failing cache](https://github.blog/changelog/2022-10-20-manage-caches-in-your-actions-workflows-from-web-interface/)
or by setting the `CACHE_VERSION` secret to the current date (which will
invalidate all of the caches).

Expand All @@ -58,32 +58,32 @@ invalidate all of the caches).

These workflows run on a schedule and at the maintainer's request. Because they
create pull requests that update workflows/require the downstream actions to run,
they need a special repository/organization secret token called
`SANDPAPER_WORKFLOW` and it must have the `public_repo` and `workflow` scope.
they need a special repository/organization secret token called
`SANDPAPER_WORKFLOW` and it must have the `public_repo` and `workflow` scope.

This can be an individual user token, OR it can be a trusted bot account. If you
have a repository in one of the official Carpentries accounts, then you do not
need to worry about this token being present because the Carpentries Core Team
will take care of supplying this token.

If you want to use your personal account: you can go to
If you want to use your personal account: you can go to
<https://github.com/settings/tokens/new?scopes=public_repo,workflow&description=Sandpaper%20Token>
to create a token. Once you have created your token, you should copy it to your
clipboard and then go to your repository's settings > secrets > actions and
create or edit the `SANDPAPER_WORKFLOW` secret, pasting in the generated token.

If you do not specify your token correctly, the runs will not fail and they will
give you instructions to provide the token for your repository.
give you instructions to provide the token for your repository.

### 02 Maintain: Update Workflow Files (update-workflow.yaml)

The {sandpaper} repository was designed to do as much as possible to separate
the tools from the content. For local builds, this is absolutely true, but
there is a minor issue when it comes to workflow files: they must live inside
the repository.
The {sandpaper} repository was designed to do as much as possible to separate
the tools from the content. For local builds, this is absolutely true, but
there is a minor issue when it comes to workflow files: they must live inside
the repository.

This workflow ensures that the workflow files are up-to-date. The way it work is
to download the update-workflows.sh script from GitHub and run it. The script
to download the update-workflows.sh script from GitHub and run it. The script
will do the following:

1. check the recorded version of sandpaper against the current version on github
Expand All @@ -100,25 +100,25 @@ This update is run weekly or on demand.

For lessons that have generated content, we use {renv} to ensure that the output
is stable. This is controlled by a single lockfile which documents the packages
needed for the lesson and the version numbers. This workflow is skipped in
needed for the lesson and the version numbers. This workflow is skipped in
lessons that do not have generated content.

Because the lessons need to remain current with the package ecosystem, it's a
good idea to make sure these packages can be updated periodically. The
good idea to make sure these packages can be updated periodically. The
update cache workflow will do this by checking for updates, applying them in a
branch called `updates/packages` and creating a pull request with _only the
lockfile changed_.
lockfile changed_.

From here, the markdown documents will be rebuilt and you can inspect what has
changed based on how the packages have updated.
changed based on how the packages have updated.

## Pull Request and Review Management

Because our lessons execute code, pull requests are a secruity risk for any
lesson and thus have security measures associted with them. **Do not merge any
pull requests that do not pass checks and do not have bots commented on them.**

This series of workflows all go together and are described in the following
This series of workflows all go together and are described in the following
diagram and the below sections:

![Graph representation of a pull request](https://carpentries.github.io/sandpaper/articles/img/pr-flow.dot.svg)
Expand All @@ -129,15 +129,15 @@ This workflow runs every time a pull request is created and its purpose is to
validate that the pull request is okay to run. This means the following things:

1. The pull request does not contain modified workflow files
2. If the pull request contains modified workflow files, it does not contain
2. If the pull request contains modified workflow files, it does not contain
modified content files (such as a situation where @carpentries-bot will
make an automated pull request)
3. The pull request does not contain an invalid commit hash (e.g. from a fork
that was made before a lesson was transitioned from styles to use the
workbench).

Once the checks are finished, a comment is issued to the pull request, which
will allow maintainers to determine if it is safe to run the
Once the checks are finished, a comment is issued to the pull request, which
will allow maintainers to determine if it is safe to run the
"Receive Pull Request" workflow from new contributors.

### Receive Pull Request (pr-receive.yaml)
Expand All @@ -154,7 +154,7 @@ started.

The first step of this workflow is to check if it is valid (e.g. that no
workflow files have been modified). If there are workflow files that have been
modified, a comment is made that indicates that the workflow is not run. If
modified, a comment is made that indicates that the workflow is not run. If
both a workflow file and lesson content is modified, an error will occurr.

The second step (if valid) is to build the generated content from the pull
Expand All @@ -164,7 +164,7 @@ request. This builds the content and uploads three artifacts:
2. A summary of changes after the rendering process (diff)
3. The rendered files (build)

Because this workflow builds generated content, it follows the same general
Because this workflow builds generated content, it follows the same general
process as the `sandpaper-main` workflow with the same caching mechanisms.

The artifacts produced are used by the next workflow.
Expand All @@ -183,9 +183,9 @@ The steps in this workflow are:
Importantly: if the pull request is invalid, the branch is not created so any
malicious code is not published.

From here, the maintainer can request changes from the author and eventually
either merge or reject the PR. When this happens, if the PR was valid, the
preview branch needs to be deleted.
From here, the maintainer can request changes from the author and eventually
either merge or reject the PR. When this happens, if the PR was valid, the
preview branch needs to be deleted.

### Send Close PR Signal (pr-close-signal.yaml)

Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This template CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to replace its contents
# with information about your lesson.
# Remember to update this file periodically,
# Remember to update this file periodically,
# ensuring that the author list and other fields remain accurate.

cff-version: 1.2.0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ to promote a safe, welcoming, and productive learning environment.
Follow the steps below to
complete the initial configuration of a new lesson repository built from this template:

1. **Adjust the
1. **Adjust the
`CITATION.cff`, `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, and `LICENSE.md` files**
as appropriate for your project.
- `CITATION.cff`:
Expand All @@ -28,9 +28,9 @@ complete the initial configuration of a new lesson repository built from this te
author list grows and other details become available or need to change.
The [Citation File Format home page][cff-home] gives more information about the format,
and the [`cffinit` webtool][cffinit] can be used to create new and update existing CFF files.
- `CODE_OF_CONDUCT.md`:
- `CODE_OF_CONDUCT.md`:
if you are using this template for a project outside The Carpentries,
you should adjust this file to describe
you should adjust this file to describe
who should be contacted with Code of Conduct reports,
and how those reports will be handled.
- `CONTRIBUTING.md`:
Expand All @@ -40,7 +40,7 @@ complete the initial configuration of a new lesson repository built from this te
to get involved and make an impact on your lesson.
- `LICENSE.md`:
in line with the terms of the CC-BY license,
you should ensure that the copyright information
you should ensure that the copyright information
provided in the license file is accurate for your project.

[cff-home]: https://citation-file-format.github.io/
Expand Down
12 changes: 5 additions & 7 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# lc: Library Carpentry
# cp: Carpentries (to use for instructor training for instance)
# incubator: The Carpentries Incubator
#
#
# This option supports custom types so lessons can be branded
# and themed with your own logo and alt-text (see `carpentry_description`)
# See https://carpentries.github.io/sandpaper-docs/editing.html#adding-a-custom-logo
Expand Down Expand Up @@ -49,7 +49,7 @@ contact: '[email protected]'
# include all pages in the folder.

# Order of episodes in your lesson
episodes:
episodes:
# chapter 1. ingestion
- introduction.md # hmm.
- working-with-diverse-filetypes.md
Expand All @@ -71,17 +71,15 @@ episodes:
- hot-takes.md

# Information for Learners
learners:
learners:

# Information for Instructors
instructors:
instructors:

# Learner Profiles
profiles:
profiles:

# Customisation ---------------------------------------------
#
# This space below is where custom yaml items (e.g. pinning
# sandpaper and varnish versions) should live


2 changes: 1 addition & 1 deletion data/eia923_2022.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/eia923_2022.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1377,4 +1377,4 @@
</request>
<apiVersion>2.1.8</apiVersion>
<ExcelAddInVersion>2.1.0</ExcelAddInVersion>
</eia_api>
</eia_api>
2 changes: 1 addition & 1 deletion data/eia923_2022_sample.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"period":"2022-12","plantCode":"6761","plantName":"Rawhide","fuel2002":"ALL","fuelTypeDescription":"Total","state":"CO","stateDescription":"Colorado","primeMover":"ALL","generation":"188961","gross-generation":"203283","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"54142","plantName":"Hillcrest Pump Station","fuel2002":"WAT","fuelTypeDescription":"Hydroelectric Conventional","state":"CO","stateDescription":"Colorado","primeMover":"HY","generation":"342.43","gross-generation":"358.27","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"54142","plantName":"Hillcrest Pump Station","fuel2002":"WAT","fuelTypeDescription":"Hydroelectric Conventional","state":"CO","stateDescription":"Colorado","primeMover":"ALL","generation":"342.43","gross-generation":"358.27","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"54142","plantName":"Hillcrest Pump Station","fuel2002":"ALL","fuelTypeDescription":"Total","state":"CO","stateDescription":"Colorado","primeMover":"ALL","generation":"342.43","gross-generation":"358.27","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"64359","plantName":"Pivot Solar 12 LLC(CSG)","fuel2002":"SUN","fuelTypeDescription":"Solar","state":"CO","stateDescription":"Colorado","primeMover":"PV","generation":"92.45","gross-generation":"92.45","generation-units":"megawatthours","gross-generation-units":"megawatthours"}]
[{"period":"2022-12","plantCode":"6761","plantName":"Rawhide","fuel2002":"ALL","fuelTypeDescription":"Total","state":"CO","stateDescription":"Colorado","primeMover":"ALL","generation":"188961","gross-generation":"203283","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"54142","plantName":"Hillcrest Pump Station","fuel2002":"WAT","fuelTypeDescription":"Hydroelectric Conventional","state":"CO","stateDescription":"Colorado","primeMover":"HY","generation":"342.43","gross-generation":"358.27","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"54142","plantName":"Hillcrest Pump Station","fuel2002":"WAT","fuelTypeDescription":"Hydroelectric Conventional","state":"CO","stateDescription":"Colorado","primeMover":"ALL","generation":"342.43","gross-generation":"358.27","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"54142","plantName":"Hillcrest Pump Station","fuel2002":"ALL","fuelTypeDescription":"Total","state":"CO","stateDescription":"Colorado","primeMover":"ALL","generation":"342.43","gross-generation":"358.27","generation-units":"megawatthours","gross-generation-units":"megawatthours"},{"period":"2022-12","plantCode":"64359","plantName":"Pivot Solar 12 LLC(CSG)","fuel2002":"SUN","fuelTypeDescription":"Solar","state":"CO","stateDescription":"Colorado","primeMover":"PV","generation":"92.45","gross-generation":"92.45","generation-units":"megawatthours","gross-generation-units":"megawatthours"}]
6 changes: 3 additions & 3 deletions episodes/accessing-remote-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ response = requests.get("URL")
<!-- TODO think about whether we want to have an example of read_xml here - since we'd then need to do io.StringIO, etc. probably not worth it? -->

The `Response` object has many useful methods and properties, but for now we can focus on these two:
* `response.text` will provide the returned data as a *text string*
* `response.text` will provide the returned data as a *text string*
* `response.json()` will parse the returned data as if it were JSON, and provide a Python list or dictionary.

:::::::: challenge
Expand Down Expand Up @@ -108,7 +108,7 @@ The other answers are wrong because:
* `json.loads(requests.get("URL").text)` does work, but this functionality is more directly achieved with `Response.json()`
* You don't need to use `with` here because there is no cleanup required after a web request returns.
::::

::::::::

:::::::: challenge
Expand Down Expand Up @@ -517,7 +517,7 @@ If you try to make this request, the JSON response will give you information abo
}
```

This suggests that if we change the `data[]` parameter to `total-consumption`, `consumption-for-eg`, `consumption-uto`, etc. we should get something back.
This suggests that if we change the `data[]` parameter to `total-consumption`, `consumption-for-eg`, `consumption-uto`, etc. we should get something back.

Which one we should change it to depends on what you want.

Expand Down
5 changes: 2 additions & 3 deletions episodes/automated-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ teaching: 0
exercises: 0
---

:::::::::::::::::::::::::::::::::::::: questions
:::::::::::::::::::::::::::::::::::::: questions

- placeholder

Expand All @@ -17,9 +17,8 @@ exercises: 0
::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints
::::::::::::::::::::::::::::::::::::: keypoints

- placeholder

::::::::::::::::::::::::::::::::::::::::::::::::

5 changes: 2 additions & 3 deletions episodes/big-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ teaching: 0
exercises: 0
---

:::::::::::::::::::::::::::::::::::::: questions
:::::::::::::::::::::::::::::::::::::: questions

- placeholder

Expand All @@ -17,9 +17,8 @@ exercises: 0
::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints
::::::::::::::::::::::::::::::::::::: keypoints

- placeholder

::::::::::::::::::::::::::::::::::::::::::::::::

5 changes: 2 additions & 3 deletions episodes/data-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ teaching: 0
exercises: 0
---

:::::::::::::::::::::::::::::::::::::: questions
:::::::::::::::::::::::::::::::::::::: questions

- placeholder

Expand All @@ -17,9 +17,8 @@ exercises: 0
::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints
::::::::::::::::::::::::::::::::::::: keypoints

- placeholder

::::::::::::::::::::::::::::::::::::::::::::::::

5 changes: 2 additions & 3 deletions episodes/data-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ teaching: 0
exercises: 0
---

:::::::::::::::::::::::::::::::::::::: questions
:::::::::::::::::::::::::::::::::::::: questions

- placeholder

Expand All @@ -17,9 +17,8 @@ exercises: 0
::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints
::::::::::::::::::::::::::::::::::::: keypoints

- placeholder

::::::::::::::::::::::::::::::::::::::::::::::::

5 changes: 2 additions & 3 deletions episodes/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ teaching: 0
exercises: 0
---

:::::::::::::::::::::::::::::::::::::: questions
:::::::::::::::::::::::::::::::::::::: questions

- placeholder

Expand All @@ -17,9 +17,8 @@ exercises: 0
::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints
::::::::::::::::::::::::::::::::::::: keypoints

- placeholder

::::::::::::::::::::::::::::::::::::::::::::::::

5 changes: 2 additions & 3 deletions episodes/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ teaching: 0
exercises: 0
---

:::::::::::::::::::::::::::::::::::::: questions
:::::::::::::::::::::::::::::::::::::: questions

- placeholder

Expand All @@ -17,9 +17,8 @@ exercises: 0
::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::::::::::::: keypoints
::::::::::::::::::::::::::::::::::::: keypoints

- placeholder

::::::::::::::::::::::::::::::::::::::::::::::::

Loading
Loading