Browse Source

fix(script) add commits list to update LJM message

master
Saúl Ibarra Corretgé 4 years ago
parent
commit
27d41604df
1 changed files with 38 additions and 4 deletions
  1. 38
    4
      resources/update-ljm.sh

+ 38
- 4
resources/update-ljm.sh View File

@@ -2,15 +2,49 @@
2 2
 
3 3
 set -e -u
4 4
 
5
+if [[ ! -z $(git status -s --untracked-files=no) ]]; then
6
+    echo "Git tree is not clean, aborting!"
7
+    exit 1
8
+fi
9
+
10
+BRANCH=$(git rev-parse --abbrev-ref HEAD)
11
+if [[ "$BRANCH" != "master" ]]; then
12
+  echo "Not on master, aborting!";
13
+  exit 1;
14
+fi
15
+
5 16
 THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
6
-LATEST_LJM_COMMIT=$(git ls-remote https://github.com/jitsi/lib-jitsi-meet.git HEAD | awk '{ print $1 }')
17
+PID=$$
18
+LJM_TMP="${TMPDIR:-/tmp}/ljm-${PID}"
7 19
 
8 20
 pushd ${THIS_DIR}/..
21
+CURRENT_LJM_COMMIT=$(jq -r '.dependencies."lib-jitsi-meet"' package.json | cut -d "#" -f2)
22
+popd
23
+
24
+git clone --branch master --single-branch --bare https://github.com/jitsi/lib-jitsi-meet ${LJM_TMP}
25
+
26
+pushd ${LJM_TMP}
27
+LATEST_LJM_COMMIT=$(git rev-parse HEAD)
28
+LJM_COMMITS=$(git log --oneline --no-decorate --no-merges ${CURRENT_LJM_COMMIT}..HEAD --pretty=format:"%x2a%x20%s")
29
+popd
30
+
31
+if [[ "${CURRENT_LJM_COMMIT}" == "${LATEST_LJM_COMMIT}" ]]; then
32
+    echo "No need to update, already on the latest commit!"
33
+    rm -rf ${LJM_TMP}
34
+    exit 1
35
+fi
36
+
37
+GH_LINK="https://github.com/jitsi/lib-jitsi-meet/compare/${CURRENT_LJM_COMMIT}...${LATEST_LJM_COMMIT}"
9 38
 
39
+pushd ${THIS_DIR}/..
40
+EPOCH=$(date +%s)
41
+NEW_BRANCH="update-ljm-${EPOCH}"
42
+git checkout -b ${NEW_BRANCH}
10 43
 npm install github:jitsi/lib-jitsi-meet#${LATEST_LJM_COMMIT}
11 44
 git add package.json package-lock.json
12
-git commit -m "chore(deps) lib-jitsi-meet@latest"
13
-
45
+git commit -m "chore(deps) lib-jitsi-meet@latest" -m "${LJM_COMMITS}" -m "${GH_LINK}"
46
+git push origin ${NEW_BRANCH}
47
+gh pr create --repo jitsi/jitsi-meet --fill
14 48
 popd
15 49
 
16
-echo "Done! Now push your branch to GH and open a PR!"
50
+rm -rf ${LJM_TMP}

Loading…
Cancel
Save