From e0fe9b1b3d157e8a7744e76ba530902cfbf0e854 Mon Sep 17 00:00:00 2001 From: Yufei Liu <62931738+yufei118liu@users.noreply.github.com> Date: Tue, 23 Jul 2024 21:44:45 +0200 Subject: [PATCH] =?UTF-8?q?Ingestion=20checklist=E2=80=94managing=20PR=20w?= =?UTF-8?q?ith=20empty=20description=20(#3673)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/link-to-checklist.yml | 25 ++++++++++++++++++++----- .github/workflows/print-info.yml | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/link-to-checklist.yml b/.github/workflows/link-to-checklist.yml index f3acfbfb4f..b5db93e264 100644 --- a/.github/workflows/link-to-checklist.yml +++ b/.github/workflows/link-to-checklist.yml @@ -18,15 +18,30 @@ jobs: echo "Action: ${{ github.event.action }}" echo "PR Title: ${{ github.event.pull_request.title }}" echo "Starts with ingestion: ${{ startsWith(github.event.pull_request.title, 'ingestion') }}" + - name: Log from GitHub script + uses: actions/github-script@v6 + with: + script: | + console.log('This is a test log.'); + console.log('Event Name:', context.eventName); + console.log('Action:', context.payload.action); + console.log('PR Title:', context.payload.pull_request.title); + console.log('Starts with ingestion:', context.payload.pull_request.title.startsWith('ingestion')); - name: Add review checklist uses: actions/github-script@v6 with: script: | const fs = require('fs'); + console.log('Reading checklist file...'); const review_checklist = fs.readFileSync('.github/ingestion-review-checklist.md', 'utf8'); + const old_description = context.payload.pull_request.body || ''; + console.log('Old description:', old_description); + const updated_body = !old_description.trim() ? review_checklist : old_description + "\n\n" + review_checklist; github.rest.pulls.update({ - pull_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: context.payload.pull_request.body + review_checklist, - }); + pull_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: updated_body, + }); + + console.log('Updated body:', updated_body); diff --git a/.github/workflows/print-info.yml b/.github/workflows/print-info.yml index 6a09ced94d..89e37321a5 100644 --- a/.github/workflows/print-info.yml +++ b/.github/workflows/print-info.yml @@ -14,3 +14,4 @@ jobs: echo "Event Name: ${{ github.event_name }}" echo "Action: ${{ github.event.action }}" echo "PR Title: ${{ github.event.pull_request.title }}" + echo "Original PR Body: ${{ github.event.pull_request.body }}"