{"id":17301999,"url":"https://github.com/twz123/rerun-pr-workflows-action","last_synced_at":"2025-07-24T17:01:49.249Z","repository":{"id":37077548,"uuid":"434662343","full_name":"twz123/rerun-pr-workflows-action","owner":"twz123","description":"Re-run GitHub workflows for incoming Pull Requests","archived":false,"fork":false,"pushed_at":"2025-03-21T18:28:32.000Z","size":2664,"stargazers_count":2,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T22:36:51.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/twz123.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-03T16:27:20.000Z","updated_at":"2024-12-21T00:07:32.000Z","dependencies_parsed_at":"2023-02-19T11:31:40.577Z","dependency_job_id":"7b82a77a-254a-46e0-9dbb-69d1dbb54872","html_url":"https://github.com/twz123/rerun-pr-workflows-action","commit_stats":{"total_commits":307,"total_committers":6,"mean_commits":"51.166666666666664","dds":0.07491856677524433,"last_synced_commit":"6f51e9bcdd7da13904761b023cd681abbfbdaf53"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twz123%2Frerun-pr-workflows-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twz123%2Frerun-pr-workflows-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twz123%2Frerun-pr-workflows-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twz123%2Frerun-pr-workflows-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twz123","download_url":"https://codeload.github.com/twz123/rerun-pr-workflows-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248884629,"owners_count":21177455,"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":[],"created_at":"2024-10-15T11:46:13.035Z","updated_at":"2025-04-14T12:50:46.077Z","avatar_url":"https://github.com/twz123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Re-run GitHub workflows for incoming Pull Requests\n\nIn order to prevent \"semantic merge conflicts\", each pull request needs to be\ntested based on its potential merge commit with its target branch. A\nfull-fledged solution to this would be to use a proper [merge\npipeline][gh-bors-ng]. While a merge pipeline is a really powerful tool that\nbecomes a game changer once a project reaches a certain size, it brings its own\ncomplexity.\n\nSmall projects can get along with a simpler solution. When using GitHub Actions\ntriggered by the [`pull_request`][action-event-pr] event, GitHub will use the\npotential merge commit by default. But those events aren't triggered when the\ntarget branch changes. This is the problem that this action tries to address.\nEvery time a push to some repository branch happens, this GitHub Action may be\nused to find all the open and mergeable pull requests targeting the branch being\npushed to, and trigger a re-run of a certain workflow on those pull requests.\n\nNote that this is not entirely bullet-proof. There are several edge cases in\nwhich bad pull requests can slip through. If that's not acceptable, please\nconsider a more elaborate approach than this one. This is a proof-of-concept\nthat might be good enough for some folks. Some edge cases are:\n\n- Pull requests get merged in quick succession:  \n  Pull requests that were passing all of their status checks before the update\n  of the target branch will remain in a mergeable state until the GitHub Action\n  for the target branch triggered their respective builds. Usually, this time\n  window is quite small, say, under a minute, but if the triggering GitHub\n  action fails or gets stuck in the execution queue, this can go unnoticed for\n  quite a while.\n- Stale pull requests:  \n  GitHub's docs [mention][gh-docs-rerun] that a GitHub workflow run can only be\n  re-run up to 30 days after the triggering event event has occurred. So\n  whenever a pull request isn't touched for longer than that period, the re-run\n  cannot be triggered anymore and some other action needs to be taken.\n\n[gh-bors-ng]: https://github.com/bors-ng/bors-ng\n[action-event-pr]: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request\n[gh-docs-rerun]: https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow\n\n## Usage\n\nIn order to use this action, you'll need to add a new workflow file to be\ntriggered when branches are updated. You'll also need the name of the workflow\nyour project uses for running tests on pull requests.\n\nE.g.:\n\nThe workflow to trigger re-running PR workflows:\n```yml\n# .github/re-run-pr-workflows.yml\nname: Re-run workflows for incoming PRs\n\non:\n  push:\n    branches:\n    - '**'\n\njobs:\n  trigger_ci:\n    name: Trigger PR tests run\n    runs-on: ubuntu-20.04\n    steps:\n    - name: Trigger PR tests run\n      uses: twz123/rerun-pr-workflows-action@v0.3\n      with:\n        workflow: Run PR Tests\n```\n\nWhere `Run PR Tests` is the name set within the file that runs the PR tests. E.g.:\n\n```yaml\n# .github/run-pr-tests.yml\nname: Run PR Tests\n\non:\n  pull_request:\n    branches: [ main, staging ]\n\n  workflow_dispatch:\n\njobs:\n  test:\n    name: Run Tests\n    runs-on: ubuntu-20.04\n\n    steps:\n      - uses: actions/checkout@v4\n\n      # Testing steps go here.\n      # ...\n```\n\n## Code in Main\n\nFirst, you'll need to have a reasonably modern version of `node` handy. The CI\nbuilds use Node 20, currently.\n\nInstall the dependencies\n\n```sh\n$ npm install\n```\n\nBuild the typescript, package it for distribution, lint, run tests ... all in\none go\n\n```sh\n$ npm run all\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwz123%2Frerun-pr-workflows-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwz123%2Frerun-pr-workflows-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwz123%2Frerun-pr-workflows-action/lists"}