1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-26 15:02:54 +02:00

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.
This commit is contained in:
Gergely Risko 2024-03-04 15:39:30 +01:00 committed by GitHub
parent 9a72b87fa9
commit e74a8b77bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 = "<!-- course-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 = "<!-- course-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,
});
}