From c9a3615f98cb68db5908843fa838f8980ca185eb Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:58:05 +0900 Subject: [PATCH] update docs --- README.md | 29 ++++++++++++++++++++++------- docs/updating.md | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6e9c3b8..46cf30a 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ All inputs are **optional**. If not set, sensible defaults will be used. | --- | --- | --- | | `token` | `GITHUB_TOKEN` (`contents: write`, `pull-requests: write`) or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` | | `path` | Relative path under `GITHUB_WORKSPACE` to the repository. | `GITHUB_WORKSPACE` | -| `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. Defaults to adding all new and modified files. See [Controlling committed files](#controlling-committed-files). | `-A` | +| `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. Defaults to adding all new and modified files. See [Add specific paths](#add-specific-paths). | `-A` | | `commit-message` | The message to use when committing changes. | `[create-pull-request] automated change` | | `committer` | The committer name and email address in the format `Display Name `. Defaults to the GitHub Actions bot user. | `GitHub ` | | `author` | The author name and email address in the format `Display Name `. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>` | @@ -126,8 +126,27 @@ To use this strategy, set input `branch-suffix` with one of the following option ### Controlling committed files The action defaults to adding all new and modified files. -You can override this behaviour and control which files are committed with the `add-paths` input. +If there are files that should not be included in the pull request, you can use the following methods to control the committed content. + +#### Remove files + +The most straightforward way to handle unwanted files is simply to remove them in a step before the action runs. + +```yml + - run: | + rm -rf temp-dir + rm temp-file.txt +``` + +#### Ignore files + +If there are files or directories you want to ignore you can simply add them to a `.gitignore` file at the root of your repository. The action will respect this file. + +#### Add specific paths + +You can control which files are committed with the `add-paths` input. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. +Each path must resolve to a least one new or modified file to add. All file changes that do not match one of the paths will be discarded. ```yml @@ -139,7 +158,7 @@ All file changes that do not match one of the paths will be discarded. docs/*.md ``` -### Controlling commits +#### Create your own commits As well as relying on the action to handle uncommitted changes, you can additionally make your own commits before the action runs. Note that the repository must be checked out on a branch with a remote, it won't work for [events which checkout a commit](docs/concepts-guidelines.md#events-which-checkout-a-commit). @@ -162,10 +181,6 @@ Note that the repository must be checked out on a branch with a remote, it won't uses: peter-evans/create-pull-request@v3 ``` -### Ignoring files - -If there are files or directories you want to ignore you can simply add them to a `.gitignore` file at the root of your repository. The action will respect this file. - ### Create a project card To create a project card for the pull request, pass the `pull-request-number` step output to [create-or-update-project-card](https://github.com/peter-evans/create-or-update-project-card) action. diff --git a/docs/updating.md b/docs/updating.md index f453220..db64ed3 100644 --- a/docs/updating.md +++ b/docs/updating.md @@ -68,6 +68,6 @@ ### New features -- Unpushed commits made during the workflow before the action runs will now be considered as changes to be raised in the pull request. See [Controlling commits](https://github.com/peter-evans/create-pull-request#controlling-commits) for details. +- Unpushed commits made during the workflow before the action runs will now be considered as changes to be raised in the pull request. See [Create your own commits](https://github.com/peter-evans/create-pull-request#create-your-own-commits) for details. - New commits made to the pull request base will now be taken into account when pull requests are updated. - If an updated pull request no longer differs from its base it will automatically be closed and the pull request branch deleted.