GitHub officially supports this feature. https://github.blog/changelog/2022-02-03-more-ways-to-keep-your-pull-request-branch-up-to-date/
Example of GitHub Actions Workflow to update pull request by pull request comment
If the branch is protected and Require branches to be up to date before merging is checked,
you can update the pull request branch using Update branch button (Reference).
But if Require branches to be up to date before merging isn't checked, you can't update the pull request branch using Update branch button.
This is inconvenient.
In stead of Update branch button, you can update the pull request easily by GitHub Actions.
By posting the pull request comment /update (You can change the comment freely), the pull request is updated.
To run new Workflows by the update, GitHub Personal Access Token or GitHub App Token are required.
secrets.GITHUB_TOKEN isn't unavailable.
When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN will not create a new workflow run
- Create GitHub Personal Access Token or GitHub App
- Add Personal Access Token or GitHub App private key to GitHub Secrets
- Copy Workflow
In case of GitHub App, you have to install the App to the repository.
Post the pull request comment /update (You can change the comment freely)

