If a PR is invalid, it's not ready for review, so we shouldn't mark it as such.
To go about this:
- The relevant binary is
pr-metadata-validator - its source is in https://github.com/CodeYourFuture/trainee-tracker/blob/main/src/bin/pr-metadata-validator.rs - you can build it with cargo build --bin pr-metadata-validator. Running it should tell you what args and env vars it needs. You can run it outside of the context of a GitHub Action.
- There are three outcomes - successful validation, detected a known problem, unknown error. By the time we get to
|
let full_message = format!("{message}\n\nIf this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed)."); |
|
eprintln!("{}", full_message); |
|
octocrab |
|
.issues(github_org_name, module_name) |
|
.create_comment(pr_number, full_message) |
|
.await |
|
.expect("Failed to create comment with validation error"); |
|
exit(2); |
we have already exited for either successful validation or an unknown error.
- We should be able to use octocrab's existing
remove_label function
- We probably want to modify the comment we post to say this has been done, and the user should re-add the label once it's been fixed.
https://github.com/CodeYourFuture/actions/blob/main/validate-pr-metadata/action.yml defines the GitHub Action YAML in case it's needed for reference, but I don't imagine we'll need to change it.
If a PR is invalid, it's not ready for review, so we shouldn't mark it as such.
To go about this:
pr-metadata-validator- its source is in https://github.com/CodeYourFuture/trainee-tracker/blob/main/src/bin/pr-metadata-validator.rs - you can build it withcargo build --bin pr-metadata-validator. Running it should tell you what args and env vars it needs. You can run it outside of the context of a GitHub Action.trainee-tracker/src/bin/pr-metadata-validator.rs
Lines 81 to 88 in b0d8e12
remove_labelfunctionhttps://github.com/CodeYourFuture/actions/blob/main/validate-pr-metadata/action.yml defines the GitHub Action YAML in case it's needed for reference, but I don't imagine we'll need to change it.