-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from nordic-rse/radovan/preview
update, simplify, and better name and file name
- Loading branch information
Showing
3 changed files
with
11 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
.github/workflows/pr_comment.yml → .github/workflows/link-to-preview.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
name: PR Comment # Write a comment in the PR with a link to the preview of the given website | ||
name: Link to preview in PR conversation | ||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
jobs: | ||
pr_comment: | ||
link-to-preview: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create PR comment | ||
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this is a pull request build AND the pull request is NOT made from a fork | ||
uses: thollander/actions-comment-pull-request@71efef56b184328c7ef1f213577c3a90edaa4aff | ||
with: | ||
message: 'Once the build has completed, you can preview your PR at this URL: https://${{ github.event.pull_request.base.repo.name }}/previews/PR${{ github.event.number }}/' | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
16 changes: 7 additions & 9 deletions
16
.github/workflows/preview_cleanup.yml → .../workflows/remove-preview-after-merge.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
# from https://github.com/CliMA/ClimaTimeSteppers.jl | ||
name: Site Preview Cleanup | ||
name: Remove preview once PR is merged or closed | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
doc-preview-cleanup: | ||
remove-preview-after-merge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout gh-pages branch | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
- name: Delete preview and history + push changes | ||
run: | | ||
if [ -d "previews/PR$PRNUM" ]; then | ||
git config user.name "Documenter.jl" | ||
git config user.email "[email protected]" | ||
git rm -rf "previews/PR$PRNUM" | ||
if [ -d "previews/PR${{ github.event.number }}" ]; then | ||
git config user.name "GH workflow" | ||
git config user.email "[email protected]" | ||
git rm -rf "previews/PR${{ github.event.number }}" | ||
git commit -m "delete preview" | ||
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) | ||
git push --force origin gh-pages-new:gh-pages | ||
fi | ||
env: | ||
PRNUM: ${{ github.event.number }} |