|
| 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} |
0 commit comments