{"id":15376359,"url":"https://github.com/cheshire137/project-pull-mover","last_synced_at":"2025-04-15T16:34:32.903Z","repository":{"id":253447971,"uuid":"843132811","full_name":"cheshire137/project-pull-mover","owner":"cheshire137","description":"Ruby gem to change the status of pull requests in a GitHub project, mark them as a draft or ready for review, apply or remove a label to indicate failing tests, etc.","archived":false,"fork":false,"pushed_at":"2025-03-21T14:33:03.000Z","size":649,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T02:35:18.259Z","etag":null,"topics":["github-projects","ruby-script"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheshire137.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-15T21:13:53.000Z","updated_at":"2025-03-24T13:09:02.000Z","dependencies_parsed_at":"2025-04-15T16:33:23.733Z","dependency_job_id":null,"html_url":"https://github.com/cheshire137/project-pull-mover","commit_stats":{"total_commits":99,"total_committers":2,"mean_commits":49.5,"dds":"0.010101010101010055","last_synced_commit":"4cf9fceb2f151301c77eb232bac4d635dc258134"},"previous_names":["cheshire137/project-pull-mover"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheshire137%2Fproject-pull-mover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheshire137%2Fproject-pull-mover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheshire137%2Fproject-pull-mover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheshire137%2Fproject-pull-mover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheshire137","download_url":"https://codeload.github.com/cheshire137/project-pull-mover/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249108900,"owners_count":21214086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-projects","ruby-script"],"created_at":"2024-10-01T14:06:56.806Z","updated_at":"2025-04-15T16:34:32.878Z","avatar_url":"https://github.com/cheshire137.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# project-pull-mover\n\nScript to change the status of a pull request in a GitHub project. On macOS, when the script is run and any pull\nrequests have their project status changed, a desktop notification will appear with the count of how many PRs were\nmoved.\n\n![Screenshot of a GitHub project in kanban board layout with several columns. There is a blue arrow from a pull request in the left-most In Progress column pointing into the adjacent Not Against Master column.](./project-screenshot.png)\n\nThe script gets the list of pull requests in the specified project, iterates through them, and updates the status field you specify based on the PR's state.\n\n## How to use\n\n### Prerequisites\n\nInstall the [`gh` command line tool](https://cli.github.com/). `gh` will be used to authenticate with the GitHub API.\nYou'll also need [Ruby](https://www.ruby-lang.org/en/documentation/installation/) installed; I built this script\nwith Ruby version 2.7.1p83.\n\nIn [GraphiQL](https://docs.github.com/en/graphql/overview/explorer), run a GraphQL query like this one to get IDs for the options in your project's \"Status\"-like column:\n\n```graphql\nquery {\n  organization(login: \"yourOrg\") {\n    projectV2(number: 123) { # e.g., https://github.com/orgs/yourOrg/projects/123\n      field(name: \"Status\") { ... on ProjectV2SingleSelectField { options { name id } } }\n    }\n  }\n}\n```\n\nYou'll use the option IDs from the GraphQL query to tell project_pull_mover where to move your pull requests in your\nproject.\n\n### Installation\n\nDownload the .gem file from the [latest release](https://github.com/cheshire137/project-pull-mover/releases/latest).\nInstall it via:\n\n```sh\ngem install project_pull_mover.gem\n```\n\nThere should now be a `project_pull_mover` executable in your path.\n\n### Options\n\n```sh\nUsage: project_pull_mover [options]\n    -p, --project-number NUM         Project number (required), e.g., 123 for https://github.com/orgs/someorg/projects/123\n    -o, --project-owner OWNER        Project owner login (required), e.g., someorg for https://github.com/orgs/someorg/projects/123\n    -t, --project-owner-type TYPE    Project owner type (required), either 'user' or 'organization'\n    -s, --status-field STATUS        Status field name (required), name of a single-select field in the project\n    -i, --in-progress ID             Option ID of 'In progress' column for status field\n    -a, --not-against-main ID        Option ID of 'Not against main' column for status field\n    -n, --needs-review ID            Option ID of 'Needs review' column for status field\n    -r, --ready-to-deploy ID         Option ID of 'Ready to deploy' column for status field\n    -c, --conflicting ID             Option ID of 'Conflicting' column for status field\n    -g, --ignored IDS                Optional comma-separated list of option IDs of columns like 'Blocked' or 'On hold' for status field\n    -q, --quiet                      Quiet mode, suppressing all output except errors\n    -h, --gh-path PATH               Path to gh executable\n    -f, --failing-test-label LABEL   Name of the label to apply to a pull request that has failing required builds\n    -u, --author AUTHOR              Specify a username so that only PRs in the project authored by that user are changed\n    -m, --mark-draft                 Also mark pull requests as a draft when setting them to In Progress, Not Against Main, or Conflicting status.\n    -v, --version                    Print version and exit\n```\n\nRun the script with:\n\n```sh\nproject_pull_mover\n```\n\nFollow instructions about required options and run suggested `gh auth` commands to get the right permissions, e.g.,\n\n```sh\nerror: your authentication token is missing required scopes [project]\nTo request it, run:  gh auth refresh -s project\n```\n\nExample use:\n\n```sh\nproject_pull_mover -p 123 -o myOrg -t organization -i 123abc -a zyx987 -n ab123cd -r a1b2c3 -c z9y8x7 -g \"idkfa1,iddqd2\" -s \"Status\"\n```\n\n### Example output\n\nExample no-op output:\n\n```sh\n⏳ Authenticating with GitHub...\n✅ Authenticated as GitHub user @cheshire137\nℹ️ 'Status' options enabled: In progress, Not against main, Needs review, Ready to deploy, Conflicting, Ignored\n⏳ Looking up items in project 123 owned by @myOrg...\n✅ Found 20 pull requests in project\nℹ️ Found pull requests in 4 unique repositories by @someRepoOwner\n⏳ Looking up more info about each pull request in project...\n✅ Loaded extra pull request info\nℹ️ No pull requests needed a different status\n```\n\nExample output when some pull requests had the wrong 'Status':\n\n```sh\n⏳ Authenticating with GitHub...\n✅ Authenticated as GitHub user @cheshire137\n⏳ Looking up items in project 123 owned by @myOrg...\n✅ Found 20 pull requests in project\nℹ️ Found pull requests in 4 unique repositories by @someRepoOwner\n⏳ Looking up more info about each pull request in project...\n✅ Loaded extra pull request info\n⏳ Moving someRepoOwner/repo1#330751 out of In progress ✏️ column to 'Conflicting'...\n⏳ Moving someRepoOwner/repo2#335443 out of In progress ✏️ column to 'Conflicting'...\n⏳ Moving someRepoOwner/repo2#337389 out of In progress ✏️ column to 'Conflicting'...\nℹ️ Updated status for 3 pull requests\n```\n\n## Automatic runs with cron\n\nMake a directory for holding logs from the script. Here is an example config for crontab:\n\n```sh\n# Runs every 30 minutes, Monday through Friday, between 9am and 5pm:\n*/31,*/1 9-17 * * 1-5 /path/to/this/repo/project_pull_mover.rb -p 123 -o myOrg -t organization -i 123abc -a zyx987 -n ab123cd -r a1b2c3 -c z9y8x7 -g \"idkfa1,iddqd2\" -s \"Status\" -q -h \"/usr/local/bin/gh\" \u003e/path/to/your/log/directory/stdout.log 2\u003e/path/to/your/log/directory/stderr.log\n```\n\nIf you have problems with `gh` not being authenticated, try a cron line like:\n\n```sh\n# Runs every 30 minutes, Monday through Friday, between 9am and 5pm:\n*/30 9-17 * * 1-5 echo \"YOUR_TOKEN_HERE\" | /usr/local/bin/gh auth login --with-token \u0026\u0026 /path/to/this/repo/project_pull_mover.rb -p 123 -o myOrg -t organization -i 123abc -a zyx987 -n ab123cd -r a1b2c3 -c z9y8x7 -g \"idkfa1,iddqd2\" -s \"Status\" -q -h \"/usr/local/bin/gh\" \u003e/path/to/your/log/directory/stdout.log 2\u003e/path/to/your/log/directory/stderr.log\n```\n\nTo get the token to use, try running `gh auth refresh -s project` first and go through the interactive authentication\nflow. Once complete, you can run `gh auth token` to get your GitHub API token.\n\n## How to develop\n\nInstall dependencies:\n\n```sh\nbundle install\n```\n\nCheck types:\n\n```sh\nbundle exec srb tc\n```\n\nRun tests:\n\n```sh\nbundle exec rake test\n```\n\nRun a single test file with a command like `ruby -Ilib:test PATH_TO_TEST`, for example:\n\n```sh\nruby -Ilib:test test/lib/project_pull_mover/utils_test.rb\n```\n\n### Creating a tag\n\nUpdate `VERSION` in [version.rb](./lib/project_pull_mover/version.rb).\n\n```sh\ngit tag v0.0.x main # use the same version as in `VERSION`\ngit push origin tag v0.0.x\n```\n\nThis will trigger a workflow that builds the gem and creates a new release.\n\n### Building the gem\n\n```sh\ngem build project_pull_mover.gemspec\n```\n\nThis will create a file like project_pull_mover-0.0.1.gem which you can then install:\n\n```sh\ngem install project_pull_mover-0.0.1.gem\n```\n\n`project_pull_mover` should then be an executable available to you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheshire137%2Fproject-pull-mover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheshire137%2Fproject-pull-mover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheshire137%2Fproject-pull-mover/lists"}