Skip to content

PR Metadata Validator: Remove "Needs Review" label for invalid PRs #32

@illicitonion

Description

@illicitonion

If a PR is invalid, it's not ready for review, so we shouldn't mark it as such.

To go about this:

  1. 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.
  2. 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.
  3. We should be able to use octocrab's existing remove_label function
  4. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions