diff --git a/README.md b/README.md index 361d4b2..c851bc4 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,26 @@ Create and synchronize a PR in a dependent repository ## Description -When used in a workflow triggered by a PR event, it will create, -update and close a matching PR in another repository. Whenever the -matching PR is modified by `cascading-pr`, it waits for the CI to -pass otherwise it fails. +If repository A depends on repository B, `cascadinging-pr` can be +used by a workflow in repository B to trigger the CI on repository A +and verify it passes when it will upgrade with the proposed change +from repository B. + +When used in a workflow triggered by a PR event in `origin-repo`, +`cascading-pr` will create, update and close a matching PR in +another repository (`destination-repo`). When the PR is updated, +`cascading-pr` subsequently will update the matching PR. The +worfklows in `origin-repo` will wait for the workflow in +`destination-repo` to complete. If the workflow in +`destination-repo` fails, the workflow in `origin-repo` will also +fail. As an example, when a PR is created in [`forgejo/runner`](https://code.forgejo.org/forgejo/runner/), a matching PR is created in [`actions/setup-forgejo`](https://code.forgejo.org/actions/setup-forgejo/) with the proposed change. `cascading-pr` will wait until the CI in -`actions/setup-forgejo` is successful. When the PR in -`forgejo/runner` is merged, the matching PR in -`actions/setup-forgejo` is updated to use what was just merged and -is ready to be reviewed. +`actions/setup-forgejo` is successful. The `update` script is expected to be found in the origin repository running the PR. It is given four arguments: @@ -34,6 +40,17 @@ running the PR. It is given four arguments: If changes are found in the destination repository directory after the `update` script runs, they will be pushed as a new commit in the PR. +`origin-token` is used when accessing `origin-repo` and needs the +`read:user`, `read:repository` and `write:issue` scopes. + +`destination-token` is used to push the branch that contains an +update to `destination-repo` and to open a pull request. It needs +the `read:user`, `write:repository` and `write:issue` scopes. + +It is recommended that a dedicated user is used to create +`destination-token` and that `destination-fork-repo` is always used +unless the users who are able to create pull requests are trusted. + When the PR is from a forked repository, the `update` script is checked out from the default branch instead of the head branch of the fork. diff --git a/action.yml b/action.yml index cbf010c..2cd0b9a 100644 --- a/action.yml +++ b/action.yml @@ -3,20 +3,26 @@ name: 'Cascading PR' author: 'Forgejo authors' description: | - When used in a workflow triggered by a PR event, it will create, - update and close a matching PR in another repository. Whenever the - matching PR is modified by `cascading-pr`, it waits for the CI to - pass otherwise it fails. + If repository A depends on repository B, `cascadinging-pr` can be + used by a workflow in repository B to trigger the CI on repository A + and verify it passes when it will upgrade with the proposed change + from repository B. + + When used in a workflow triggered by a PR event in `origin-repo`, + `cascading-pr` will create, update and close a matching PR in + another repository (`destination-repo`). When the PR is updated, + `cascading-pr` subsequently will update the matching PR. The + worfklows in `origin-repo` will wait for the workflow in + `destination-repo` to complete. If the workflow in + `destination-repo` fails, the workflow in `origin-repo` will also + fail. As an example, when a PR is created in [`forgejo/runner`](https://code.forgejo.org/forgejo/runner/), a matching PR is created in [`actions/setup-forgejo`](https://code.forgejo.org/actions/setup-forgejo/) with the proposed change. `cascading-pr` will wait until the CI in - `actions/setup-forgejo` is successful. When the PR in - `forgejo/runner` is merged, the matching PR in - `actions/setup-forgejo` is updated to use what was just merged and - is ready to be reviewed. + `actions/setup-forgejo` is successful. The `update` script is expected to be found in the origin repository running the PR. It is given four arguments: @@ -33,6 +39,17 @@ description: | If changes are found in the destination repository directory after the `update` script runs, they will be pushed as a new commit in the PR. + `origin-token` is used when accessing `origin-repo` and needs the + `read:user`, `read:repository` and `write:issue` scopes. + + `destination-token` is used to push the branch that contains an + update to `destination-repo` and to open a pull request. It needs + the `read:user`, `write:repository` and `write:issue` scopes. + + It is recommended that a dedicated user is used to create + `destination-token` and that `destination-fork-repo` is always used + unless the users who are able to create pull requests are trusted. + When the PR is from a forked repository, the `update` script is checked out from the default branch instead of the head branch of the fork.