From 9fab31dbbf504b33cf68f03af82fbd6a4f6d6e07 Mon Sep 17 00:00:00 2001 From: NSMBot Date: Fri, 20 Nov 2020 07:15:23 +0000 Subject: [PATCH] Update common CI files to latest version from networkservicemesh/cmd-template@master networkservicemesh/cmd-template#45 networkservicemesh/cmd-template PR link: https://github.com/networkservicemesh/cmd-template/pull/45 networkservicemesh/cmd-template commit message: commit 4558c78de90a6a04846df663a46cf7a107f6f064 Author: Denis Tingaikin <49399980+denis-tingajkin@users.noreply.github.com> Date: Fri Nov 20 14:15:04 2020 +0700 add missed working-directory (#45) Signed-off-by: Denis Tingajkin Signed-off-by: NSMBot --- .github/workflows/ci.yaml | 40 ++++++++++--------- .github/workflows/pr-for-updates.yaml | 2 +- .../update-integration-k8s-kind.yaml | 40 ++++++++++--------- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index df399d6..416e296 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -222,6 +222,23 @@ jobs: path: ${{ github.repository }} repository: ${{ github.repository }} token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} + - name: Create branch name + working-directory: ${{ github.repository }} + run: | + diff=$(git diff --name-only) + BRANCH_NAME="${{ github.event.repository.name }}" + if [[ $(grep "go.mod" <<< "${diff}") && $(grep "" -c <<< "${diff}") == 2 ]]; then + sdkPattern="github.com\/networkservicemesh\/sdk " + sdkVersion=$(grep --regexp "${sdkPattern}" go.mod) + BRANCH_NAME="${sdkVersion:${#sdkPattern}}" + else + { + git push origin --delete update/"${BRANCH_NAME}" + } || { + echo Branch update/"${BRANCH_NAME}" is already deleted + } + fi; + echo BRANCH_NAME=${BRANCH_NAME} >> $GITHUB_ENV - name: Create commit message working-directory: ${{ github.repository }} run: | @@ -239,7 +256,7 @@ jobs: path: networkservicemesh/integration-k8s-kind repository: networkservicemesh/integration-k8s-kind token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} - - uses: benjlevesque/short-sha@v1.1 + - uses: benjlevesque/short-sha@v1.2 id: short-sha with: length: 8 @@ -257,24 +274,11 @@ jobs: echo Repository already up to date exit 0; fi - diff=$(git diff --name-only) - branchName="${{ github.event.repository.name }}" - if [[ $(grep "go.mod" <<< "${diff}") && $(grep "" -c <<< "${diff}") == 2 ]]; then - sdkPattern="github.com\/networkservicemesh\/sdk " - sdkVersion=$(grep --regexp "${sdkPattern}" go.mod) - branchName="${sdkVersion:${#sdkPattern}}" - else - { - git push origin --delete update/"${branchName}" - } || { - echo Branch update/"${branchName}" is already deleted - } - fi; git config --global user.email "nsmbot@networkservicmesh.io" git config --global user.name "NSMBot" git commit -s -F /tmp/commit-message - git checkout -b update/"${branchName}" - while [ $(git push origin update/"${branchName}") ]; do - git fetch origin update/"${branchName}" - git rebase origin/update/"${branchName}" + git checkout -b update/"${BRANCH_NAME}" + while [ $(git push origin update/"${BRANCH_NAME}") ]; do + git fetch origin update/"${BRANCH_NAME}" + git rebase origin/update/"${BRANCH_NAME}" done diff --git a/.github/workflows/pr-for-updates.yaml b/.github/workflows/pr-for-updates.yaml index 7133c29..b44b978 100644 --- a/.github/workflows/pr-for-updates.yaml +++ b/.github/workflows/pr-for-updates.yaml @@ -16,7 +16,7 @@ jobs: echo ${PULL_REQUEST_BODY} echo PULL_REQUEST_BODY=${PULL_REQUEST_BODY} >> $GITHUB_ENV - name: pull-request-action - uses: vsoch/pull-request-action@1.0.6 + uses: vsoch/pull-request-action@1.0.12 env: GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} BRANCH_PREFIX: "update/" diff --git a/.github/workflows/update-integration-k8s-kind.yaml b/.github/workflows/update-integration-k8s-kind.yaml index 4b70a7b..006af87 100644 --- a/.github/workflows/update-integration-k8s-kind.yaml +++ b/.github/workflows/update-integration-k8s-kind.yaml @@ -17,6 +17,23 @@ jobs: path: ${{ github.repository }} repository: ${{ github.repository }} token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} + - name: Create branch name + working-directory: ${{ github.repository }} + run: | + diff=$(git diff --name-only) + BRANCH_NAME="${{ github.event.repository.name }}" + if [[ $(grep "go.mod" <<< "${diff}") && $(grep "" -c <<< "${diff}") == 2 ]]; then + sdkPattern="github.com\/networkservicemesh\/sdk " + sdkVersion=$(grep --regexp "${sdkPattern}" go.mod) + BRANCH_NAME="${sdkVersion:${#sdkPattern}}" + else + { + git push origin --delete update/"${BRANCH_NAME}" + } || { + echo Branch update/"${BRANCH_NAME}" is already deleted + } + fi; + echo BRANCH_NAME=${BRANCH_NAME} >> $GITHUB_ENV - name: Create commit message working-directory: ${{ github.repository }} run: | @@ -34,7 +51,7 @@ jobs: path: networkservicemesh/integration-k8s-kind repository: networkservicemesh/integration-k8s-kind token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} - - uses: benjlevesque/short-sha@v1.1 + - uses: benjlevesque/short-sha@v1.2 id: short-sha with: length: 8 @@ -52,24 +69,11 @@ jobs: echo Repository already up to date exit 0; fi - diff=$(git diff --name-only) - branchName="${{ github.event.repository.name }}" - if [[ $(grep "go.mod" <<< "${diff}") && $(grep "" -c <<< "${diff}") == 2 ]]; then - sdkPattern="github.com\/networkservicemesh\/sdk " - sdkVersion=$(grep --regexp "${sdkPattern}" go.mod) - branchName="${sdkVersion:${#sdkPattern}}" - else - { - git push origin --delete update/"${branchName}" - } || { - echo Branch update/"${branchName}" is already deleted - } - fi; git config --global user.email "nsmbot@networkservicmesh.io" git config --global user.name "NSMBot" git commit -s -F /tmp/commit-message - git checkout -b update/"${branchName}" - while [ $(git push origin update/"${branchName}") ]; do - git fetch origin update/"${branchName}" - git rebase origin/update/"${branchName}" + git checkout -b update/"${BRANCH_NAME}" + while [ $(git push origin update/"${BRANCH_NAME}") ]; do + git fetch origin update/"${BRANCH_NAME}" + git rebase origin/update/"${BRANCH_NAME}" done