Comments (6)
#76 implements this but it doesn't work because the "delete preview" push to gh-pages
gets cancelled before it does its thing.
from climatelaboratorybook.
Maybe the best approach is to set up a new action that runs after the rendered book is already pushed to gh-pages
and simply checks out the gh-pages
branch, deletes the appropriate _preview/[PR number]
directory, and pushes the changes.
This action may be useful: https://github.com/marketplace/actions/add-commit
from climatelaboratorybook.
Or maybe a simpler one: https://github.com/stefanzweifel/git-auto-commit-action
from climatelaboratorybook.
Rather than running a delete action immediately upon merge, we could just run a daily or weekly "clean up" action that looks for anything in the _preview/
directory of the gh-pages
branch, and removes anything not associated with a currently open PR.
For this, we would just need to be able to test if a given PR number is open.
from climatelaboratorybook.
Nevermind, I found a better / simpler solution.
In #77 We introduce a new delete_preview.yaml
workflow that runs in the context
on:
pull_request_target:
types: closed
This means that it is called on merge OR on PR close, and either way it runs from the main branch so it has the credentials to push file changes to the gh_pages
branch.
From there, it's just a matter of
- checking out the
gh_pages
branch - deleting files in the appropriate
_preview/[PR number]
directory - pushing those changes to the GitHub repo
Then the gh-pages automation takes over.
If you watch the action reports, it looks like this action gets skipped when the main deploy-book.yaml
action pushes to gh-pages. But that's just the part where GitHub takes the files in the gh-pages
repo and deploys them to the pages website. The important thing is that we get the file changes pushed into the repo.
I tested this all out, and found that:
- Previews are appropriately deleted when a PR is merged OR closed
- This does NOT conflict with or accidentally delete other preview for still-open PRs
So basically all the functionality is there!
Some more candy could be added, like:
- updating the message with the preview link to say that it's been deleted
- not posting the link until the pages are actually visible on GitHub pages (I'm not sure how to do that)
But I don't think any of that is necessary right now.
from climatelaboratorybook.
I should finish migrating this repo to use the reusable Pythia Cookbook actions (following the Cookbook Template). Will leave this issue open until that work is done.
from climatelaboratorybook.
Related Issues (20)
- Broken links to AGU journals
- Broken internal link HOT 1
- Favor ARCO datasets where possible
- The book should have suggested outlines for undergrad and grad-level use.
- Should all sensitivity parameters have the same sign convention? HOT 2
- Reformat the book source for Sphinx HOT 1
- some images are missing in Land-Ocean lecture HOT 1
- Lots of missing images HOT 3
- Introducing CESM has a data problem HOT 1
- Need cover art!
- "Advanced" topics need to be better integrated
- Animations aren't sized correctly
- References section HOT 4
- Book build is failing due to upstream JupyterBook change HOT 1
- Get rid of ugly white stripe on maps HOT 1
- Build previews are broken HOT 1
- Update references to climlab source
- Use of abbreviations like TOA -- add reference table? HOT 1
- climlab does not import correctly in Google Colab HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from climatelaboratorybook.