Skip to content

Make the CI runtime analyzer configurable instead of editing source for tokens and inputs #2

Description

@ANonABento

Problem

Longest_CI_Path.py is only usable by editing source constants at the bottom of the file:

token = 'your-personal-access-token'
owner = 'WATonomous'
repo = 'infra-config'
workflow_file_path = 'provision.yml'
workflow_name = 'Provision'

The README also instructs users to update the token variable in source. This encourages putting personal access tokens in a tracked file and makes the script hard to automate across repos/workflows.

There are also a couple of correctness hazards nearby: getRunIds(...) uses page 0 even though GitHub pagination is 1-based, and getWorkflowJobs(...) uses per_page=67 without paginating remaining jobs.

Suggested fix

  • Read the token from GITHUB_TOKEN or GH_TOKEN instead of a source variable.
  • Add CLI args for owner, repo, workflow file, workflow name, and run-history limit.
  • Start pagination at page 1 and paginate workflow jobs with per_page=100 until exhausted.
  • Update the README with an example command.

Relevant files

  • Longest_CI_Path.py
  • README.md

Metadata

Metadata

Assignees

No one assigned

    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