Skip to content

Commit

Permalink
- Changed comment action in deploy_to_github_pages workflow to access…
Browse files Browse the repository at this point in the history
…-nri/actions/.github/actions/comment

- Removed forked repos PRs from to the PR previews
  • Loading branch information
atteggiani committed Feb 12, 2025
1 parent 2683ecb commit 230052d
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/deploy_to_github_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,18 @@ permissions:


jobs:
preview-setup:
pr-preview-setup:
# If the action is fired because of a PR, run this job
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Set up PR preview title
# Set up infos for PR (new, updated or reopened branch not having a head as 'development' or 'main' branch)
if: ${{ github.event.pull_request.head.ref != 'development' && github.event.pull_request.head.ref != 'main' }}
run: |
echo 'TITLE=PR preview' >> $GITHUB_ENV
- name: Set up development preview title
# Set up infos for PR (new, updated or reopened branch not having a head as 'development' or 'main' branch)
if: ${{ github.event.pull_request.head.ref == 'development' }}
run: |
echo 'TITLE=Development website preview' >> $GITHUB_ENV
- name: Get date
run: echo "DATE=$(date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV

- name: Set up open PR message
if: ${{ github.event.action != 'closed' }}
run: |
MULTI_LINES_TEXT="${{ env.TITLE }}\n
MULTI_LINES_TEXT="PR Preview\n
:---:\n
🛫 Deployment still ongoing.<br>
Preview URL will be available at the end of the deployment.\n
Expand All @@ -66,11 +54,10 @@ jobs:
echo "EOF" >> $GITHUB_ENV
- name: Set preview
uses: thollander/actions-comment[email protected]
uses: access-nri/actions/.github/actions/comment@main
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: ${{ env.MSG }}
label: pr-preview

build:
# Cancel any previous build/deploy jobs that are still running (no need to build/deploy multiple times)
Expand Down Expand Up @@ -114,7 +101,7 @@ jobs:
git checkout development
mkdocs build -f mkdocs.yml -d ../website/development-website
echo "Build PR websites"
open_pr_info=$(gh pr list --json headRefOid,number,headRefName --jq '.[] | select(.headRefName!="development" and .headRefName!="main")')
open_pr_info=$(gh pr list --json headRepositoryOwner,headRefOid,number,headRefName --jq '.[] | select(.headRefName!="development" and .headRefName!="main" and .headRepositoryOwner.login=="${{ github.repository_owner }}")')
pr_nums=($(jq '.number' <<< "$open_pr_info"))
pr_sha=($(jq -r '.headRefOid' <<< "$open_pr_info"))
if [[ -n $pr_nums ]]; then
Expand Down

0 comments on commit 230052d

Please sign in to comment.