-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Comment on the pull request. | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Github Pages"] | ||
types: [in_progress, completed] | ||
|
||
jobs: | ||
in-progress: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.status == 'in_progress' }} | ||
steps: | ||
- name: 'Comment on PR - Waiting for deployment' | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.workflow_run.pull_requests.number }} | ||
id: deploy-preview | ||
message: "Starting deployment of preview ⏳..." | ||
on-failure: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: 'Comment on PR - Waiting for deployment' | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.workflow_run.pull_requests.number }} | ||
id: deploy-preview | ||
message: "⚠️⚠️⚠️ Build Failed: No preview available." | ||
on-success: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | ||
env: | ||
PR_PATH: dipy.org/pull/${{github.event.workflow_run.pull_requests.number}} | ||
BASE_URL: https://dipy.github.io/dipy-preview | ||
steps: | ||
- name: Update comment | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.workflow_run.pull_requests.number }} | ||
id: deploy-preview | ||
message: "A preview of ${{ github.event.workflow_run.head_commit }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }}/${{ env.PR_PATH }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | ||
|
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,10 +1,10 @@ | ||
name: github pages | ||
name: Github Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request_target: | ||
pull_request: | ||
branches: | ||
- master | ||
schedule: | ||
|
@@ -13,29 +13,15 @@ on: | |
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
issues: write | ||
env: | ||
PR_PATH: pull/${{github.event.number}} | ||
PR_PATH: dipy.org/pull/${{github.event.number}} | ||
BASE_URL: https://dipy.github.io/dipy.org | ||
HEAD: ${{ github.event.pull_request.head.repo.full_name }} | ||
BASE: ${{ github.repository }} | ||
NB: ${{github.event.number}} | ||
REF: ${{github.ref}} | ||
STATUS: ${{github.event.pull_request.head.repo.full_name != github.repository}} | ||
steps: | ||
- name: Comment on PR | ||
uses: hasura/[email protected] | ||
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "Starting deployment of preview ⏳..." | ||
|
||
- name: Checkout website repo | ||
uses: actions/checkout@v4 | ||
|
||
|
@@ -74,21 +60,13 @@ jobs: | |
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_TOKEN }} | ||
external_repository: dipy/preview-html | ||
publish_dir: ./_build/html | ||
publish_branch: main | ||
destination_dir: ${{ env.PR_PATH }} | ||
keep_files: true | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{ github.event.head_commit.message }} | ||
|
||
- name: Update comment | ||
uses: hasura/[email protected] | ||
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }}/${{ env.PR_PATH }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | ||
|