This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-site.git


The following commit(s) were added to refs/heads/master by this push:
     new adcf3e5  ARROW-6843: [GitHub Actions] Disable deploy on pull request
adcf3e5 is described below

commit adcf3e551513d56668b93c760448be5ed647af8d
Author: Sutou Kouhei <k...@clear-code.com>
AuthorDate: Thu Oct 10 09:56:15 2019 +0900

    ARROW-6843: [GitHub Actions] Disable deploy on pull request
    
    Because GITHUB_TOKEN for pull request from forked repository doesn't
    have write permission.
    
    We still deploy to asf-site when pull request is merged.
    
    Closes #33 from kou/disable-deploy-on-pull-request and squashes the 
following commits:
    
    d52b7e2b <Sutou Kouhei>  Disable deploy on pull request
    
    Authored-by: Sutou Kouhei <k...@clear-code.com>
    Signed-off-by: Sutou Kouhei <k...@clear-code.com>
---
 .github/workflows/deploy.yml | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 27aefe8..5623fb1 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -40,7 +40,8 @@ jobs:
           echo "TARGET_BRANCH=asf-site" >> ../env.sh
           echo >> _extra_config.yml
         if: |
-          github.event_name == 'push' && github.repository == 
'apache/arrow-site'
+          github.event_name == 'push' &&
+            github.repository == 'apache/arrow-site'
       - name: Configure for GitHub Pages on master
         run: |
           owner=$(jq .repository.owner.login ${GITHUB_EVENT_PATH})
@@ -51,7 +52,8 @@ jobs:
           # "url:" is for the opengraph tags, and it can't be relative
           echo "url: https://${owner}.github.io/${repository}"; >> 
_extra_config.yml
         if: |
-          github.event_name == 'push' && github.repository != 
'apache/arrow-site'
+          github.event_name == 'push' &&
+            github.repository != 'apache/arrow-site'
       - name: Configure for GitHub Pages on pull request
         run: |
           owner=$(jq --raw-output .pull_request.head.user.login 
${GITHUB_EVENT_PATH})
@@ -100,6 +102,10 @@ jobs:
           fi
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        if: |
+          github.event_name == 'push' ||
+            (github.event_name == 'pull_request' &&
+              github.repository == 
github.event.pull_request.head.repo.full_name)
       - name: Comment GitHub Pages URL
         uses: actions/github-script@0.2.0
         with:
@@ -107,14 +113,17 @@ jobs:
           script: |
             const payload = context.payload;
             const base_repo = payload.pull_request.base.repo;
-            const head_repo = payload.pull_request.head.repo;
+            const head = payload.pull_request.head;
+            const head_repo = head.repo;
             const github_pages_url =
               `https://${head_repo.owner.login}.github.io/${head_repo.name}/`;
-            const body = `${github_pages_url}\n${payload.after}`;
+            const body = `${github_pages_url}\n${head.sha}`;
             github.issues.createComment({
                                           "owner": base_repo.owner.login,
                                           "repo": base_repo.name,
                                           "issue_number": payload.number,
                                           "body": body
                                         });
-        if: github.event_name == 'pull_request'
+        if: |
+          github.event_name == 'pull_request' &&
+            github.repository == github.event.pull_request.head.repo.full_name

Reply via email to