Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions docs/common-issues.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,67 @@
# Common issues

- [Troubleshooting](#troubleshooting)
- [Command substitution in action inputs](#command-substitution-in-action-inputs)
- [Create using an existing branch as the PR branch](#create-using-an-existing-branch-as-the-pr-branch)
- [Frequently requested features](#use-case-create-a-pull-request-to-update-x-on-release)
- [Disable force updates to existing PR branches](#disable-force-updates-to-existing-pr-branches)
- [Add a no-verify option to bypass git hooks](#add-a-no-verify-option-to-bypass-git-hooks)

## Troubleshooting

### Command substitution in action inputs

Shell command substitution (e.g., `$(date)`, backticks, or other shell expansions) does not work directly in GitHub Actions workflow inputs. This is a limitation of how GitHub Actions processes YAML inputs—they are treated as literal strings, not executed as shell commands.

**This will NOT work:**
```yml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: "Update Daily $(date -u +'%B %d, %Y')"
title: "Update Daily $(date -u +'%B %d, %Y')"
```

The `$(date -u +'%B %d, %Y')` will appear literally in your commit message and PR title instead of being replaced with the actual date.

**Solution 1: Use a separate shell step with outputs (Recommended)**

Execute the shell command in a separate step and pass the result to the action using GitHub Actions outputs:

```yml
- name: Set PR variables
id: vars
run: |
echo "date=$(date -u +'%B %d, %Y')" >> $GITHUB_OUTPUT
echo "commit_msg=Update Daily $(date -u +'%B %d, %Y')" >> $GITHUB_OUTPUT

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: ${{ steps.vars.outputs.commit_msg }}
title: "Update Daily ${{ steps.vars.outputs.date }}"
body: Automated daily update.
```

**Solution 2: Use environment variables**

Set environment variables in a shell step and reference them in the action:

```yml
- name: Set environment variables
run: |
echo "PR_DATE=$(date -u +'%B %d, %Y')" >> $GITHUB_ENV

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: "Update Daily ${{ env.PR_DATE }}"
title: "Update Daily ${{ env.PR_DATE }}"
body: Automated daily update.
```

For more examples of using dynamic values in pull requests, see [Dynamic configuration using variables](examples.md#dynamic-configuration-using-variables).

### Create using an existing branch as the PR branch

A common point of confusion is to try and use an existing branch containing changes to raise in a PR as the `branch` input. This will not work because the action is primarily designed to be used in workflows where the PR branch does not exist yet. The action creates and manages the PR branch itself.
Expand Down