-
Notifications
You must be signed in to change notification settings - Fork 11
32 lines (31 loc) · 1.33 KB
/
pr-handler.yml
File metadata and controls
32 lines (31 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Handle Pull Request
on:
pull_request_target:
types: [opened]
jobs:
add-lando-link:
runs-on: ubuntu-latest
steps:
- name: Add Lando link
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
#
# Set the following variables at the repository level [0].
# [0] https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#defining-configuration-variables-for-multiple-workflows
#
LANDO_BASE_URL: ${{ vars.LANDO_BASE_URL }}
LANDO_REPO: ${{ vars.LANDO_REPO }}
#
# If they are empty, the following will be used to determine sane defaults.
#
DEFAULT_LANDO_BASE_URL: https://lando.moz.tools
GITHUB_REPO: ${{ github.repository }}
TARGET_BRANCH: ${{ github.base_ref}}
run: |
LANDO_BASE_URL="${LANDO_BASE_URL:-${DEFAULT_LANDO_BASE_URL}}"
# We extract the GitHub repo name and target branch to use as
# default LANDO_REPO if unspecified.
LANDO_REPO="${LANDO_REPO:-${GITHUB_REPO/*\//}-${TARGET_BRANCH}}"
gh pr comment "${PR}" --body "[View this pull request in Lando](${LANDO_BASE_URL}/pulls/${LANDO_REPO}/${PR}) to land it once approved."