From e74a8b77bd1842c6c1ee810a467463756117516d Mon Sep 17 00:00:00 2001 From: Gergely Risko Date: Mon, 4 Mar 2024 15:39:30 +0100 Subject: [PATCH] URGENT: Fix course schedule watcher github action (#1867) @djmitche Currently all PRs are marked as schedule change PRs. This is my try to propose a fix for this, but please review diligently, I'm no github actions expert, and I don't have an environment to test. --- .github/workflows/course-schedule-comment.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/course-schedule-comment.yml b/.github/workflows/course-schedule-comment.yml index 6059c671..69a9c390 100644 --- a/.github/workflows/course-schedule-comment.yml +++ b/.github/workflows/course-schedule-comment.yml @@ -56,11 +56,11 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - var fs = require('fs'); - var pr_number = Number(fs.readFileSync('pr-number')); - var upstream = fs.readFileSync('upstream-schedule').toString(); - var schedule = fs.readFileSync('schedule').toString(); - schedule = "\n" + + const fs = require('fs'); + const pr_number = Number(fs.readFileSync('pr-number')); + const upstream = fs.readFileSync('upstream-schedule').toString(); + const schedule = fs.readFileSync('schedule').toString(); + const new_schedule = "\n" + "# Changes to Course Schedule\n" + "This PR changes the course schedule. The new schedule is shown below.\n\n" + schedule; @@ -83,13 +83,13 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, comment_id: existing_comment.id, - body: schedule, + body: new_schedule, }); } else if (upstream != schedule) { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr_number, - body: schedule, + body: new_schedule, }); }