From 82d1182fb51b780367d29f03a1b1bb87012efddb Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 21:20:29 -0700 Subject: [PATCH 1/9] Use create-pull-request v2 --- .github/workflows/pkg-update.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index 3d81cc61..4c003627 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -14,10 +14,17 @@ jobs: - uses: actions/checkout@v2 # https://github.com/tkf/julia-merge-except-manifests - - name: 'Merge master to create-pull-request/pkg-update' + - name: 'Merge master to create-pull-request/pkg-update-2' uses: tkf/julia-merge-except-manifests@v1 with: - target: create-pull-request/pkg-update + target: create-pull-request/pkg-update-2 + + # Since create-pull-request does not like when the current + # branch is the target branch, checkout a temporary one. + # https://github.com/JuliaFolds/Transducers.jl/pull/167 + - name: "Checkout a temporary branch" + run: + git checkout -b create-pull-request/pkg-update-tmp # https://github.com/tkf/julia-update-manifests - name: Update */Manifest.toml @@ -29,7 +36,7 @@ jobs: # https://github.com/peter-evans/create-pull-request # https://github.com/marketplace/actions/create-pull-request - name: Create Pull Request - uses: peter-evans/create-pull-request@v1 + uses: peter-evans/create-pull-request@v2 with: token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} commit-message: Update */Manifest.toml @@ -46,8 +53,7 @@ jobs: # --- Commit Message and squash Method # https://doc.mergify.io/actions.html#commit-message-and-squash-method labels: no changelog - branch: create-pull-request/pkg-update - branch-suffix: none + branch: create-pull-request/pkg-update-2 base: master - name: Check output environment variable run: echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}" From f05e271b13fe0bd4282df093d7060248a2266874 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 21:39:53 -0700 Subject: [PATCH 2/9] Checkout master --- .github/workflows/pkg-update.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index 4c003627..b10e8e96 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -20,11 +20,15 @@ jobs: target: create-pull-request/pkg-update-2 # Since create-pull-request does not like when the current - # branch is the target branch, checkout a temporary one. + # branch is the target branch, checkout master. # https://github.com/JuliaFolds/Transducers.jl/pull/167 - - name: "Checkout a temporary branch" - run: - git checkout -b create-pull-request/pkg-update-tmp + - name: "Checkout and merge to master" + run: | + if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] + then + git checkout master + git merge --ff-only create-pull-request/pkg-update-2 + fi # https://github.com/tkf/julia-update-manifests - name: Update */Manifest.toml From 402e86ddbca73ce4fb8643254704048419f368cb Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 21:57:27 -0700 Subject: [PATCH 3/9] DEBUG spam --- .github/workflows/pkg-update.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index b10e8e96..960eb63b 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -37,6 +37,9 @@ jobs: version: '1.4' projects: test/environments/main benchmark docs + - name: "spam" + run: "echo spam > src/ThreadsX.jl" + # https://github.com/peter-evans/create-pull-request # https://github.com/marketplace/actions/create-pull-request - name: Create Pull Request From 86e5c4bdbea2329d6b8546d1ce14db9ea5b45f5d Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 22:08:45 -0700 Subject: [PATCH 4/9] Use SSH key instead of access token --- .github/workflows/pkg-update.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index 960eb63b..e00ba944 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -12,6 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + # https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-using-ssh-deploy-keys # https://github.com/tkf/julia-merge-except-manifests - name: 'Merge master to create-pull-request/pkg-update-2' @@ -45,7 +48,7 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v2 with: - token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} commit-message: Update */Manifest.toml title: 'Update */Manifest.toml' body: | From b743df2a3a1290a6f9e9edf65052ff44b36533a4 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 22:26:40 -0700 Subject: [PATCH 5/9] Use tkf/julia-merge-except-manifests@dev --- .github/workflows/pkg-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index e00ba944..6ec9ae7e 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -18,7 +18,7 @@ jobs: # https://github.com/tkf/julia-merge-except-manifests - name: 'Merge master to create-pull-request/pkg-update-2' - uses: tkf/julia-merge-except-manifests@v1 + uses: tkf/julia-merge-except-manifests@dev with: target: create-pull-request/pkg-update-2 From 6fc85207e12985d79092f5a19d367f8a023d7bcf Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 23:13:52 -0700 Subject: [PATCH 6/9] Fetch branches in workflow file --- .github/workflows/pkg-update.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index 6ec9ae7e..674eb109 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -16,6 +16,11 @@ jobs: ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} # https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-using-ssh-deploy-keys + - name: "Fetch branches" + run: | + git fetch --unshallow origin master + git fetch origin create-pull-request/pkg-update-2 || true + # https://github.com/tkf/julia-merge-except-manifests - name: 'Merge master to create-pull-request/pkg-update-2' uses: tkf/julia-merge-except-manifests@dev From 4dfe08c7a46bbce9e8d1a1d9d87830752adfaa3c Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 27 Jun 2020 23:38:09 -0700 Subject: [PATCH 7/9] git checkout -B master origin/master --- .github/workflows/pkg-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index 674eb109..af3fb61b 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -20,6 +20,7 @@ jobs: run: | git fetch --unshallow origin master git fetch origin create-pull-request/pkg-update-2 || true + git checkout -B master origin/master # https://github.com/tkf/julia-merge-except-manifests - name: 'Merge master to create-pull-request/pkg-update-2' From 9f4f1f4cab256cccf7681e39a8008e3220220d16 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sun, 28 Jun 2020 00:31:11 -0700 Subject: [PATCH 8/9] Do git operations outside docker --- .github/workflows/pkg-update.yml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index af3fb61b..f7b4dbb6 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -16,17 +16,31 @@ jobs: ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} # https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-using-ssh-deploy-keys - - name: "Fetch branches" + - name: 'Merge master to create-pull-request/pkg-update-2' run: | - git fetch --unshallow origin master - git fetch origin create-pull-request/pkg-update-2 || true - git checkout -B master origin/master + base="master" + target="create-pull-request/pkg-update-2" - # https://github.com/tkf/julia-merge-except-manifests - - name: 'Merge master to create-pull-request/pkg-update-2' - uses: tkf/julia-merge-except-manifests@dev - with: - target: create-pull-request/pkg-update-2 + git_fetch_origin() { + git fetch --unshallow origin "$1" || git fetch origin "$1" + } + + set -ex + + git_fetch_origin "refs/heads/$base:refs/remotes/origin/$base" + git checkout -B "$base" "origin/$base" + + git_fetch_origin "refs/heads/$target:refs/remotes/origin/$target" || exit 0 + git checkout -B "$target" "origin/$target" + git merge --strategy=ours --no-commit "$base" + find . -type d -name .git -prune -o -type f -print0 | xargs --null rm -rf + git checkout "$base" -- . + git ls-tree -r --name-only "origin/$target" | grep -F Manifest.toml \ + | xargs git checkout "origin/$target" -- + git ls-tree -r --name-only "origin/$target" | grep -F Manifest.toml \ + | xargs git add -f -- + git add . + git commit -m "Merge branch '$base'" || exit 0 # Since create-pull-request does not like when the current # branch is the target branch, checkout master. From a3450bbfa8f2a5104bfb00615ac041254fa67475 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sun, 28 Jun 2020 00:35:29 -0700 Subject: [PATCH 9/9] Revert "DEBUG spam" This reverts commit 402e86ddbca73ce4fb8643254704048419f368cb. --- .github/workflows/pkg-update.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pkg-update.yml b/.github/workflows/pkg-update.yml index f7b4dbb6..a0cac305 100644 --- a/.github/workflows/pkg-update.yml +++ b/.github/workflows/pkg-update.yml @@ -60,9 +60,6 @@ jobs: version: '1.4' projects: test/environments/main benchmark docs - - name: "spam" - run: "echo spam > src/ThreadsX.jl" - # https://github.com/peter-evans/create-pull-request # https://github.com/marketplace/actions/create-pull-request - name: Create Pull Request