From f7570e0bd2d187c3d8bb08c3e7773a79126a1726 Mon Sep 17 00:00:00 2001 From: Kevin van Rijn Date: Wed, 4 Oct 2023 09:03:16 +0200 Subject: [PATCH] Don't action for now --- .github/workflows/automerge.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index b130ad494fe..ac474f885f8 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -14,23 +14,35 @@ jobs: continue-on-error: true with: ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 3 + fetch-depth: 1 - name: package_json shell: bash run: | if [[ -f package.json ]]; then bash --noprofile --norc -e -o pipefail docs/tools/git-config.sh + git fetch --depth 1 origin +master:master --no-tags + echo "$(git log -1 --format=%H)" + echo "$(git log ${{ github.event.pull_request.head.ref }} -1 --format=%H)" export npm_version=$(curl -sS 'https://registry.npmjs.org/npm' | python -c "import sys, json; print(json.load(sys.stdin)['dist-tags']['latest-6'])") export new_npm_version=$(cat package.json | python -c "import sys, json; print(json.load(sys.stdin)['dependencies']['npm'])") sed -i -z "s/\"npm\": \"[a-zA-Z0-9+.-]*\"/\"npm\": \"$npm_version\"/2" -- package.json sed -i "0,/\"npm\": \".*\"/s//\"npm\": \"$npm_version || $new_npm_version\"/" -- package.json git add package.json + git status + git log -1 git -c user.name="GitHub" -c user.email="noreply@github.com" commit --author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -m"Fix package.json" | sed -n 1p || true git push - if [[ $(git diff --stat "$(git log -1 --skip=2 --format=%H)" "$(git log -1 --format=%H)" --) -eq 0 ]]; then - echo "automerge_pull_action=close" >> "$GITHUB_ENV" + git status + git log origin/master -1 + git log -1 + if [ "$(git log -1 --format=%H)" = "$(git log ${{ github.event.pull_request.head.ref }} -1 --format=%H)" ]; then + echo "automerge_pull_action=merge" # >> "$GITHUB_ENV" else - echo "automerge_pull_action=merge" >> "$GITHUB_ENV" + if [[ $(git diff --stat "$(git log origin/master -1 --format=%H)" "$(git log -1 --format=%H)" --) -eq 0 ]]; then + echo "automerge_pull_action=close" # >> "$GITHUB_ENV" + else + echo "automerge_pull_action=merge" # >> "$GITHUB_ENV" + fi fi fi - name: automerge