-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (31 loc) · 1.33 KB
/
update-pr-description.yml
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
33
name: Update PR Description
on:
pull_request:
types: [opened, synchronize]
jobs:
update-description:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Add PR base ref
# Fetch the ref of the base branch, just the single commit.
run: git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
- name: Track PR base branch
# Turn the just-fetched ref into a local branch.
run: git branch --track ${{github.base_ref}} origin/${{github.base_ref}}
- name: Fetch commits in-between base and HEAD
# While the ancestor commit between HEAD and the branch base isn't in the local tree
# fetch X more parent commits of the branch base and branch head.
run: |
while [ -z $( git merge-base ${{github.base_ref}} HEAD ) ]; do
git fetch --deepen=10 origin ${{github.base_ref}} HEAD;
done
# Sets the commit SHAs of head and branch base into two environment variables
# that `nx affected` will read from.
- name: Derive SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: ${{github.base_ref}}