From 8a9ebe650dca967453cd1745cb771e53b3bb5ace Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sun, 27 Aug 2023 23:04:37 -0500 Subject: [PATCH 1/2] Only attempt to leave comments on PRs from this repo Also adds a step to output array-api-test summary into the log (step which works for PRs regardless whether they are opened from a fork, or from a branch in this repo). --- .github/workflows/conda-package.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 9298742ac6..d0ad1c8205 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -608,7 +608,11 @@ jobs: echo "Array API standard conformance tests failed to run for dpctl=$PACKAGE_VERSION." exit 1 fi + - name: Output API summary + shell: bash -l {0} + run: echo "::notice ${{ env.MESSAGE }}" - name: Post result to PR + if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork }} uses: mshick/add-pr-comment@v1 with: message: | From e06bf4044be256ab9cbe4fb2d0db85d3820bf0ea Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Sun, 27 Aug 2023 23:06:25 -0500 Subject: [PATCH 2/2] Generate docs made friendly for PRs from forks Only publish sources and comments with link to them for PRs opened from branches in this repo. PRs from forks would have artifacts with rendered docs uploaded. --- .github/workflows/generate-docs.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index bae12e4373..84bbed4622 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -76,7 +76,7 @@ jobs: mv ../cmake-install/docs/docs ~/docs git clean -dfx - name: Publish docs - if: ${{ github.ref == 'refs/heads/master' }} + if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.ref == 'refs/heads/master' }} shell: bash -l {0} run: | git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git @@ -91,8 +91,15 @@ jobs: git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com' git commit -m "Latest docs." git push tokened_docs gh-pages + - name: Save built docs as an artifact + if: ${{ github.event.pull_request && github.event.pull_request.head.repo.fork && github.event.action != 'closed'}} + uses: actions/upload-artifact@v3 + with: + name: ${{ env.PACKAGE_NAME }} rendered documentation + path: ~/docs + - name: Publish pull-request docs - if: ${{ github.event.pull_request && github.event.action != 'closed' }} + if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }} env: PR_NUM: ${{ github.event.number }} shell: bash -l {0} @@ -111,7 +118,7 @@ jobs: git commit -m "Docs for pull request ${PR_NUM}" git push tokened_docs gh-pages - name: Unpublish pull-request docs - if: ${{ github.event.pull_request && github.event.action == 'closed' }} + if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }} env: PR_NUM: ${{ github.event.number }} shell: bash -l {0} @@ -128,7 +135,7 @@ jobs: git commit -m "Removing docs for closed pull request ${PR_NUM}" git push tokened_docs gh-pages - name: Comment with URL to published pull-request docs - if: ${{ github.event.pull_request && github.event.action != 'closed' }} + if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action != 'closed' }} env: PR_NUM: ${{ github.event.number }} uses: mshick/add-pr-comment@v1 @@ -138,7 +145,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token-user-login: 'github-actions[bot]' - name: Comment with URL about removal of PR docs - if: ${{ github.event.pull_request && github.event.action == 'closed' }} + if: ${{ github.event.pull_request && !github.event.pull_request.head.repo.fork && github.event.action == 'closed' }} env: PR_NUM: ${{ github.event.number }} uses: mshick/add-pr-comment@v1