From 84a64431a9341dee71d6927cf30d2dae7769755f Mon Sep 17 00:00:00 2001 From: Mikhail Avramenko Date: Mon, 2 Aug 2021 11:23:14 +0700 Subject: [PATCH 1/2] changed nsmbot message Signed-off-by: Mikhail Avramenko --- .github/workflows/automerge.yaml | 1 + .github/workflows/pr-for-updates.yaml | 8 +++++--- .../update-dependent-repositories.yaml | 17 +++++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml index 4d24fc0..8d9fcdd 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/automerge.yaml @@ -28,3 +28,4 @@ jobs: ENABLED_FOR_MANUAL_CHANGES: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MAXIMUM_RETRIES: 25 + MERGE_METHOD: REBASE diff --git a/.github/workflows/pr-for-updates.yaml b/.github/workflows/pr-for-updates.yaml index 364e8b1..ed6ef4d 100644 --- a/.github/workflows/pr-for-updates.yaml +++ b/.github/workflows/pr-for-updates.yaml @@ -12,9 +12,11 @@ jobs: - uses: actions/checkout@v2 - name: Construct PR message run: | - PULL_REQUEST_BODY=$(git log -1) - echo ${PULL_REQUEST_BODY} - echo PULL_REQUEST_BODY=${PULL_REQUEST_BODY} >> $GITHUB_ENV + PULL_REQUEST_BODY=$(git log --pretty='format:%B' -1 | sed '/^$/d;$d' | sed 's/#/# /g') + echo "$PULL_REQUEST_BODY" + echo "PULL_REQUEST_BODY<> $GITHUB_ENV + echo "$PULL_REQUEST_BODY" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV - name: pull-request-action uses: vsoch/pull-request-action@1.0.12 env: diff --git a/.github/workflows/update-dependent-repositories.yaml b/.github/workflows/update-dependent-repositories.yaml index b98d4ec..be6c8a1 100644 --- a/.github/workflows/update-dependent-repositories.yaml +++ b/.github/workflows/update-dependent-repositories.yaml @@ -30,20 +30,25 @@ jobs: path: ${{ github.repository }} repository: ${{ github.repository }} token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} + - name: Get sha + id: get-sha + run: | + echo ::set-output name=sha::$( curl -u "u:${{secrets.NSM_BOT_GITHUB_TOKEN}}" https://api.github.com/repos/networkservicemesh/sdk-k8s/git/ref/heads/main | jq .object.sha | tr -d '"' ) - name: Find merged PR - uses: jwalton/gh-find-current-pr@v1 + uses: jwalton/gh-find-current-pr@v1.0.2 id: findPr with: + sha: ${{ steps.get-sha.outputs.sha }} github-token: ${{ github.token }} - name: Create commit message working-directory: ${{ github.repository }} run: | - echo "Update go.mod and go.sum to latest version from ${{ github.repository }}@main ${{ github.repository }}#${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message - echo "" >> /tmp/commit-message - echo "${{ github.repository }} PR link: https://github.com/${{ github.repository }}/pull/${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message + echo "Update go.mod and go.sum to latest version from ${{ github.repository }}@main" >> /tmp/commit-message + echo "PR link: https://github.com/${{ github.repository }}/pull/${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message echo "" >> /tmp/commit-message - echo "${{ github.repository }} commit message:" >> /tmp/commit-message - git log -1 >> /tmp/commit-message + LOG_MSG=$(git log --date=iso --pretty='format:Commit: %h%nAuthor: %an%nDate: %ad%nMessage:%n - %B%n' -1 | sed '/^$/d;$d') + for((i=2;i<=18;i+=2)); do n=$(printf '%*s' $((i+2))) m=$(printf '%*s' $i) LOG_MSG=$(echo "$LOG_MSG" | tr '\n' '|' | sed "s/${m}-/${n}-/2g" | tr '|' '\n'); done + echo "$LOG_MSG" >> /tmp/commit-message echo "Commit Message:" cat /tmp/commit-message - name: Checkout networkservicemesh/${{ matrix.repository }} From 62e5f0bcd6a019ad1a0f61e5317b173304c58fbd Mon Sep 17 00:00:00 2001 From: Mikhail Avramenko Date: Wed, 11 Aug 2021 10:10:11 +0700 Subject: [PATCH 2/2] changed merge method, simplified sha Signed-off-by: Mikhail Avramenko --- .github/workflows/automerge.yaml | 1 - .github/workflows/update-dependent-repositories.yaml | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml index 8d9fcdd..4d24fc0 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/automerge.yaml @@ -28,4 +28,3 @@ jobs: ENABLED_FOR_MANUAL_CHANGES: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MAXIMUM_RETRIES: 25 - MERGE_METHOD: REBASE diff --git a/.github/workflows/update-dependent-repositories.yaml b/.github/workflows/update-dependent-repositories.yaml index be6c8a1..27417a2 100644 --- a/.github/workflows/update-dependent-repositories.yaml +++ b/.github/workflows/update-dependent-repositories.yaml @@ -30,15 +30,11 @@ jobs: path: ${{ github.repository }} repository: ${{ github.repository }} token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} - - name: Get sha - id: get-sha - run: | - echo ::set-output name=sha::$( curl -u "u:${{secrets.NSM_BOT_GITHUB_TOKEN}}" https://api.github.com/repos/networkservicemesh/sdk-k8s/git/ref/heads/main | jq .object.sha | tr -d '"' ) - name: Find merged PR uses: jwalton/gh-find-current-pr@v1.0.2 id: findPr with: - sha: ${{ steps.get-sha.outputs.sha }} + sha: ${{ github.sha }} github-token: ${{ github.token }} - name: Create commit message working-directory: ${{ github.repository }}