From 979d417e9d5380a1af86cc8f03b06cc9b3ce0b6a Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Tue, 5 Nov 2019 13:23:16 +0900 Subject: [PATCH] Update examples --- examples.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples.md b/examples.md index ed5071c..e53a9cf 100644 --- a/examples.md +++ b/examples.md @@ -120,6 +120,8 @@ jobs: This is a pattern that works well for any automated code linting and fixing. A pull request can be created to fix or modify something during an `on: pull_request` workflow. The pull request containing the fix will be raised with the original pull request as the base. This can be then be merged to update the original pull request and pass any required tests. +Note that due to [limitations on forked repositories](https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions#token-permissions) workflows for this use case do not work for pull requests raised from forks. + ### autopep8 The following is an example workflow for a use case where [autopep8 action](https://github.com/peter-evans/autopep8) runs as both a check on pull requests and raises a further pull request to apply code fixes. @@ -136,7 +138,8 @@ name: autopep8 on: pull_request jobs: autopep8: - if: startsWith(github.head_ref, 'autopep8-patches') == false + # Check if the PR is not raised by this workflow and is not from a fork + if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - uses: actions/checkout@v1