Skip to content

Commit

Permalink
Ingestion checklist - managing empty descriptions(with console logs) (#…
Browse files Browse the repository at this point in the history
…3669)

* Resolve the bug for empty description

* Printing pr body for debugging

* Updating syntex

* add console log to debug

* checking console log

* add test log
  • Loading branch information
yufei118liu committed Jul 15, 2024
1 parent 25f169b commit 202ce59
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/link-to-checklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,38 @@ 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');
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,
});
const old_description = context.payload.pull_request.body || '';
console.log('Old description:', ${ old_description });
if (!old_description.trim()) {
await github.rest.pulls.update({
pull_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: review_checklist,
});
console.log('Pull request description was empty. Updated with review checklist.');
} else {
await 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,
});
console.log('Pull request description was not empty. Appended review checklist.');
}
1 change: 1 addition & 0 deletions .github/workflows/print-info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"

0 comments on commit 202ce59

Please sign in to comment.