22
33This directory contains workflows to be used for Lessons using the {sandpaper}
44lesson infrastructure. Two of these workflows require R (` sandpaper-main.yaml `
5- and ` pr-recieve .yaml ` ) and the rest are bots to handle pull request management.
5+ and ` pr-receive .yaml ` ) and the rest are bots to handle pull request management.
66
77These workflows will likely change as {sandpaper} evolves, so it is important to
88keep them up-to-date. To do this in your lesson you can do the following in your
@@ -43,11 +43,14 @@ This workflow does the following:
4343#### Caching
4444
4545This workflow has two caches; one cache is for the lesson infrastructure and
46- the other is for the the lesson dependencies if the lesson contains rendered
46+ the other is for the lesson dependencies if the lesson contains rendered
4747content. These caches are invalidated by new versions of the infrastructure and
4848the ` renv.lock ` file, respectively. If there is a problem with the cache,
49- manual invaliation is necessary and can be done by setting the ` CACHE_VERSION `
50- secret to the current date.
49+ manual invaliation is necessary. You will need maintain access to the repository
50+ and you can either go to the actions tab and [ click on the caches button to find
51+ and invalidate the failing cache] ( https://github.blog/changelog/2022-10-20-manage-caches-in-your-actions-workflows-from-web-interface/ )
52+ or by setting the ` CACHE_VERSION ` secret to the current date (which will
53+ invalidate all of the caches).
5154
5255## Updates
5356
@@ -56,15 +59,15 @@ secret to the current date.
5659These workflows run on a schedule and at the maintainer's request. Because they
5760create pull requests that update workflows/require the downstream actions to run,
5861they need a special repository/organization secret token called
59- ` SANDPAPER_WORKFLOW ` and it must have the ` repo ` and ` workflow ` scope.
62+ ` SANDPAPER_WORKFLOW ` and it must have the ` public_repo ` and ` workflow ` scope.
6063
6164This can be an individual user token, OR it can be a trusted bot account. If you
6265have a repository in one of the official Carpentries accounts, then you do not
6366need to worry about this token being present because the Carpentries Core Team
6467will take care of supplying this token.
6568
6669If you want to use your personal account: you can go to
67- < https://github.com/settings/tokens/new?scopes=repo ,workflow&description=Sandpaper%20Token >
70+ < https://github.com/settings/tokens/new?scopes=public_repo ,workflow&description=Sandpaper%20Token >
6871to create a token. Once you have created your token, you should copy it to your
6972clipboard and then go to your repository's settings > secrets > actions and
7073create or edit the ` SANDPAPER_WORKFLOW ` secret, pasting in the generated token.
@@ -86,24 +89,25 @@ will do the following:
86891 . check the recorded version of sandpaper against the current version on github
87902 . update the files if there is a difference in versions
8891
89- After the files are updated, a pull request is created if there are any changes.
90- Maintainers are encouraged to review the changes and accept the pull request.
92+ After the files are updated, if there are any changes, they are pushed to a
93+ branch called ` update/workflows ` and a pull request is created. Maintainers are
94+ encouraged to review the changes and accept the pull request if the outputs
95+ are okay.
9196
92- This update is run ~~ weekly or~~ on demand.
97+ This update is run weekly or on demand.
9398
94- TODO:
95- - perform check if a pull request exists before creating pull request
96-
97- ### 03 Maintain: Update Pacakge Cache (update-cache.yaml)
99+ ### 03 Maintain: Update Package Cache (update-cache.yaml)
98100
99101For lessons that have generated content, we use {renv} to ensure that the output
100102is stable. This is controlled by a single lockfile which documents the packages
101- needed for the lesson and the version numbers.
103+ needed for the lesson and the version numbers. This workflow is skipped in
104+ lessons that do not have generated content.
102105
103106Because the lessons need to remain current with the package ecosystem, it's a
104107good idea to make sure these packages can be updated periodically. The
105- update cache workflow will do this by checking for updates, applying them and
106- creating a pull request with _ only the lockfile changed_ .
108+ update cache workflow will do this by checking for updates, applying them in a
109+ branch called ` updates/packages ` and creating a pull request with _ only the
110+ lockfile changed_ .
107111
108112From here, the markdown documents will be rebuilt and you can inspect what has
109113changed based on how the packages have updated.
@@ -136,13 +140,18 @@ Once the checks are finished, a comment is issued to the pull request, which
136140will allow maintainers to determine if it is safe to run the
137141"Receive Pull Request" workflow from new contributors.
138142
139- ### Recieve Pull Request (pr-recieve .yaml)
143+ ### Receive Pull Request (pr-receive .yaml)
140144
141145** Note of caution:** This workflow runs arbitrary code by anyone who creates a
142146pull request. GitHub has safeguarded the token used in this workflow to have no
143147priviledges in the repository, but we have taken precautions to protect against
144148spoofing.
145149
150+ This workflow is triggered with every push to a pull request. If this workflow
151+ is already running and a new push is sent to the pull request, the workflow
152+ running from the previous push will be cancelled and a new workflow run will be
153+ started.
154+
146155The first step of this workflow is to check if it is valid (e.g. that no
147156workflow files have been modified). If there are workflow files that have been
148157modified, a comment is made that indicates that the workflow is not run. If
@@ -156,13 +165,13 @@ request. This builds the content and uploads three artifacts:
1561653 . The rendered files (build)
157166
158167Because this workflow builds generated content, it follows the same general
159- process as the sandpaper-main workflow with the same caching mechanisms.
168+ process as the ` sandpaper-main ` workflow with the same caching mechanisms.
160169
161170The artifacts produced are used by the next workflow.
162171
163172### Comment on Pull Request (pr-comment.yaml)
164173
165- This workflow is triggered if the ` pr-recieve .yaml ` workflow is successful.
174+ This workflow is triggered if the ` pr-receive .yaml ` workflow is successful.
166175The steps in this workflow are:
167176
1681771 . Test if the workflow is valid and comment the validity of the workflow to the
@@ -172,7 +181,7 @@ The steps in this workflow are:
1721813 . If it is valid: update the pull request comment with the summary of changes
173182
174183Importantly: if the pull request is invalid, the branch is not created so any
175- malicious code is not published.
184+ malicious code is not published.
176185
177186From here, the maintainer can request changes from the author and eventually
178187either merge or reject the PR. When this happens, if the PR was valid, the
0 commit comments