Copilot commented on code in PR #68:
URL: https://github.com/apache/arrow-erlang/pull/68#discussion_r3534237499


##########
.github/workflows/docs.yml:
##########
@@ -85,8 +73,75 @@ jobs:
       - name: Upload artifact
         uses: 
actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
         with:
+          name: docs-${{ github.sha }}
           path: 'doc'
 
-      - name: Deploy to GitHub Pages
-        id: deployment
+  deploy_fork:
+    name: Deploy to GitHub Pages on fork
+    if: >-
+      (github.event_name == 'push' ||
+       github.event_name == 'workflow_dispatch') &&
+       github.repository != 'apache/arrow-erlang'
+    needs: build
+
+    # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+    permissions:
+      contents: read
+      pages: write
+      id-token: write
+
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "pages"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - id: deployment
         uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # 
v5.0.0
+        with:
+           artifact_name: docs-${{ github.sha }}
+
+
+  asf_site:
+    # Only deploy on a push to main
+    if: github.ref_name == 'main' && github.event_name == 'push' && 
github.repository == 'apache/arrow-erlang'
+    name: Deploy to arrow.apache.org
+    needs: build
+
+    permissions:
+      contents: write
+
+    # Allow only one concurrent deployment
+    concurrency:
+      group: "asf_site"
+      cancel-in-progress: true
+
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 
v7.0.0
+        with:
+          persist-credentials: false
+
+      - name: Download artifact
+        uses: 
actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+        with:
+          name: docs-${{ github.sha }}
+          path: docs
+      - name: Prepare website
+        run: |
+          tar -xf docs/artifact.tar -C asf-site/main
+          cp .asf.yaml asf-site
+          cp .htaccess asf-site

Review Comment:
   The workflow extracts the docs artifact into `asf-site/main`, but that 
directory doesn’t exist in the repository. `tar -C asf-site/main` will fail 
unless the directory is created first.



##########
.htaccess:
##########
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+ErrorDocument 404 /erlang/main/404.html
+
+RedirectMatch permanent ^/erlang/(?!main)(.*)$ https://arrow.hexdocs.pm/$1

Review Comment:
   This redirect excludes any path starting with `main` (e.g. `/erlang/mainly`) 
from redirecting to HexDocs. If the intent is to only keep `/erlang/main` (and 
its subpaths) on arrow.apache.org, tighten the negative lookahead to 
`main(/|$)`.



##########
.github/workflows/pr_comment.yml:
##########
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: PR comment
+
+on: # zizmor: ignore[dangerous-triggers]
+  pull_request_target:
+    types:
+      - opened
+
+permissions:
+  contents: read
+  issues: write
+  pull-requests: write
+
+jobs:
+  preview-url:
+    name: Preview URL
+    runs-on: ubuntu-latest
+    steps:

Review Comment:
   This workflow comments a "Preview URL" for every opened PR, including PRs 
from branches within `apache/arrow-erlang`. In that case the URL points at 
`https://apache.github.io/...`, which typically isn’t configured and is 
misleading. Consider only commenting when the PR comes from a fork.



##########
CONTRIBUTING.md:
##########
@@ -120,3 +120,38 @@ Please read our [development
 documentation](https://arrow.apache.org/docs/developers/index.html) or
 look through the [New Contributor's
 Guide](https://arrow.apache.org/docs/developers/guide/index.html).
+
+### Forks
+
+We deploy a preview of the ExDoc documentation of any fork as a part of our
+tests.
+
+On a commit to all branches, the rendered static site will be
+published to GitHub Pages using GitHub Actions. The latest commit is
+only visible because all publications use the same url:
+https://${YOUR_GITHUB_ACCOUNT}.github.io/arrow-erlang/
+
+You need to configure your fork repository to use this feature:
+
+1. Enable GitHub Pages on your fork:
+   1. Open 
https://github.com/${YOUR_GITHUB_ACCOUNT}/arrow-erlang/settings/pages
+   2. Select "GitHub Actions" as "Source"
+2. Accept publishing GitHub Pages from all branches on your fork:
+   1. Open 
https://github.com/${YOUR_GITHUB_ACCOUNT}/arrow-erlang/settings/environments
+   2. Select the "github-pages" environment
+   3. Change the default "Deployment branches and tags" rule:
+      1. Press the "Edit" button
+      2. Change the "Name pattern" to `*` from `main` or `gh-pages`
+
+See also the [GitHub Pages
+documentation](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow).
+
+
+FYI: You can also generate the site for 
https://arrow.apache.org/arrow-erlang/main

Review Comment:
   This URL path doesn’t match the deployment described in the PR (and the 
`.asf.yaml` homepage). It should be `/erlang/main/`, not `/arrow-erlang/main`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to