Fix docs about using in public forks
Update docs section about using the Action in public forks. Add warning about current issue when the forks lives under an organisation. Mark section about running a workflow in the head repository as outdated, as I was not able to reproduce this in test projects. See https://github.com/stefanzweifel/git-auto-commit-action/issues/211#issuecomment-1428849944 for more details.
This commit is contained in:
parent
6436584fbb
commit
8e108d701f
19
README.md
19
README.md
@ -286,7 +286,10 @@ See [this announcement from GitHub](https://github.blog/2020-08-03-github-action
|
||||
> This Action technically works with forks. However, please note that the combination of triggers and their options can cause issues. Please read [the documentation](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows) on which triggers GitHub Actions support.\
|
||||
> Ensure your contributors enable "Allow edits by maintainers" when opening a pull request. ([Learn more](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)) \
|
||||
> \
|
||||
> If you use this Action in combination with a linter/fixer, it's easier if you run the Action on `push` on your `main`-branch.
|
||||
> **If you use this Action in combination with a linter/fixer, it's easier if you run the Action on `push` on your `main`-branch.**
|
||||
|
||||
> **Warning**
|
||||
> Due to limitations of GitHub, this Action currently can't push commits to a base repository, if the fork _lives_ under an organisation. See [github/community#6634](https://github.com/orgs/community/discussions/5634) and [this comment](https://github.com/stefanzweifel/git-auto-commit-action/issues/211#issuecomment-1428849944) for details.
|
||||
|
||||
By default, this Action will not run on Pull Requests which have been opened by forks. (This is a limitation by GitHub, not by us.)
|
||||
However, there are a couple of ways to use this Actions in Workflows that should be triggered by forked repositories.
|
||||
@ -312,10 +315,19 @@ on:
|
||||
jobs:
|
||||
php-cs-fixer:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
# Checkout the fork/head-repository and push changes to the fork.
|
||||
# If you skip this, the base repository will be checked out and changes
|
||||
# will be committed to the base repository!
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
|
||||
# Checkout the branch made in the fork. Will automatically push changes
|
||||
# back to this branch.
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Run php-cs-fixer
|
||||
@ -326,6 +338,11 @@ jobs:
|
||||
|
||||
### Workflow should run in **forked** repository
|
||||
|
||||
> **Warning**
|
||||
> **This part of the documentation is outdated.**
|
||||
> We were not able to configure a GitHub Action workflow for forks, that the workflow would run in the fork / head repository.
|
||||
> Please let us know in the [discussions](https://github.com/stefanzweifel/git-auto-commit-action/discussions)-area, if and how you achieved that.
|
||||
|
||||
If the workflow should run in the forked repository, follow these steps:
|
||||
|
||||
1. In addition to listening to the `pull_request` event in your Workflow triggers, you have to add an additional event: `pull_request_target`. You can learn more about this event in [the GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target).
|
||||
|
Loading…
Reference in New Issue
Block a user