Skip to content

Commit bd9b17d

Browse files
Setup PR Comment Workflow
1 parent bf2651e commit bd9b17d

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/pr_comment.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: PR comment
19+
20+
on:
21+
pull_request_target:
22+
types:
23+
- opened
24+
25+
permissions:
26+
contents: read
27+
issues: write
28+
pull-requests: write
29+
30+
jobs:
31+
preview-url:
32+
name: Preview URL
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Comment
36+
env:
37+
GH_TOKEN: ${{ github.token }}
38+
PR_REPOSITORY: ${{ github.event.pull_request.base.repo.full_name }}
39+
FORK_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
40+
PR_NUMBER: ${{ github.event.number }}
41+
run: |
42+
configure_url="https://github.com/apache/arrow-erlang/blob/main/CONTRIBUTING.md#forks"
43+
fork_owner=${FORK_REPOSITORY%/*}
44+
fork_repository=${FORK_REPOSITORY#*/}
45+
{
46+
echo "Preview URL: https://${fork_owner}.github.io/${fork_repository}"
47+
echo ""
48+
echo "If the preview URL doesn't work, you may forget to configure your fork repository for preview."
49+
echo "See ${configure_url} how to configure."
50+
} | tee body.md
51+
gh pr comment ${PR_NUMBER} \
52+
--body-file body.md \
53+
--repo ${PR_REPOSITORY}

CONTRIBUTING.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,38 @@ Please read our [development
120120
documentation](https://arrow.apache.org/docs/developers/index.html) or
121121
look through the [New Contributor's
122122
Guide](https://arrow.apache.org/docs/developers/guide/index.html).
123+
124+
### Forks
125+
126+
We deploy a preview of the ExDoc documentation of any fork as a part of our
127+
tests.
128+
129+
On a commit to all branches, the rendered static site will be
130+
published to GitHub Pages using GitHub Actions. The latest commit is
131+
only visible because all publications use the same url:
132+
https://${YOUR_GITHUB_ACCOUNT}.github.io/arrow-erlang/
133+
134+
You need to configure your fork repository to use this feature:
135+
136+
1. Enable GitHub Pages on your fork:
137+
1. Open https://github.com/${YOUR_GITHUB_ACCOUNT}/arrow-erlang/settings/pages
138+
2. Select "GitHub Actions" as "Source"
139+
2. Accept publishing GitHub Pages from all branches on your fork:
140+
1. Open https://github.com/${YOUR_GITHUB_ACCOUNT}/arrow-erlang/settings/environments
141+
2. Select the "github-pages" environment
142+
3. Change the default "Deployment branches and tags" rule:
143+
1. Press the "Edit" button
144+
2. Change the "Name pattern" to `*` from `main` or `gh-pages`
145+
146+
See also the [GitHub Pages
147+
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).
148+
149+
150+
FYI: You can also generate the site for https://arrow.apache.org/arrow-erlang/main
151+
to `doc/` locally by running the following:
152+
153+
154+
```shell
155+
rebar3 ex_doc
156+
```
157+

0 commit comments

Comments
 (0)