From 8593f0492da0f0e7eef6708d6c99592d43344ae5 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 28 Jun 2024 14:54:00 +0300 Subject: [PATCH] Remove PR checkout code --- .github/workflows/sync-backport-changelog.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sync-backport-changelog.yml b/.github/workflows/sync-backport-changelog.yml index 544bb61ed8e91..d1fd7aa6cf339 100644 --- a/.github/workflows/sync-backport-changelog.yml +++ b/.github/workflows/sync-backport-changelog.yml @@ -1,19 +1,18 @@ -name: Check Core Backport Changlog +name: Sync Core Backport Changelog Issue on: push: branches: - try/sync-backport-changelog + jobs: sync-backport-changelog: - name: Sync Core backport changelogs to issues + name: Sync Core Backport Changelog Issue runs-on: ubuntu-latest steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Sync Issues + + - name: Sync Issue uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: | @@ -42,11 +41,12 @@ jobs: console.log(`Latest version: ${version}`); const { execSync } = require('child_process'); - const processedChangelog = execSync(`awk '/./ {print ($0 ~ /^[-*]/ ? " " : "- ") $0}' backport-changelog/${version}/*.md`).toString(); + const processedChangelog = execSync(`awk '/./ {print ($0 ~ /^[-*]/ ? " " : "- ") $0}' backport-changelog/${version}/*.md`).toString().trim(); + const prependChangelog = `This description is continuously generated by a script. Please do not edit, leave comments instead.\n\n`; const body = prependChangelog + processedChangelog; - if (latestIssue.body.trim() !== body) { + if (latestIssue.body.trim() !== body.trim()) { console.log(processedChangelog); await github.rest.issues.update({ owner: context.repo.owner, @@ -54,6 +54,7 @@ jobs: issue_number: latestIssue.number, body }); + console.log('Issue description updated successfully.'); } else { console.log('Issue description is already up to date.'); }