Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7beba58e42 | ||
|
|
062968931c | ||
|
|
76116b7f39 | ||
|
|
e635c55400 | ||
|
|
9e25487be4 | ||
|
|
39529236f7 | ||
|
|
f0728e6543 | ||
|
|
188c998f8f |
28
.github/workflows/create-pull-request-multi.yml
vendored
Normal file
28
.github/workflows/create-pull-request-multi.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
on:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [create-pull-request-multi]
|
||||||
|
name: create-pull-request action testing workflow
|
||||||
|
jobs:
|
||||||
|
createPullRequest:
|
||||||
|
name: Testing on ${{ matrix.platform }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: Create report file
|
||||||
|
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
|
||||||
|
run: touch report.txt
|
||||||
|
- name: Create report file (windows)
|
||||||
|
if: matrix.platform == 'windows-latest'
|
||||||
|
run: type NUL > report.txt
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@multi-platform-release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
COMMIT_MESSAGE: Add report file
|
||||||
|
PULL_REQUEST_BODY: This PR is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request).
|
||||||
|
PULL_REQUEST_BRANCH: test-patches
|
||||||
|
PULL_REQUEST_TITLE: '[Test] Add report file'
|
||||||
|
BRANCH_SUFFIX: 'timestamp'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
on:
|
on:
|
||||||
repository_dispatch:
|
repository_dispatch:
|
||||||
types: [test]
|
types: [create-pull-request]
|
||||||
name: create-pull-request action testing workflow
|
name: create-pull-request action testing workflow
|
||||||
jobs:
|
jobs:
|
||||||
createPullRequest:
|
createPullRequest:
|
||||||
@@ -8,10 +8,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: Create report file
|
- name: Create report file
|
||||||
uses: finnp/create-file-action@1.0.0
|
run: touch report.txt
|
||||||
env:
|
|
||||||
FILE_DATA: This is created to test create-pull-request action.
|
|
||||||
FILE_NAME: report.txt
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.7.3
|
FROM alpine:3.10.2
|
||||||
|
|
||||||
LABEL maintainer="Peter Evans <mail@peterevans.dev>"
|
LABEL maintainer="Peter Evans <mail@peterevans.dev>"
|
||||||
LABEL repository="https://github.com/peter-evans/create-pull-request"
|
LABEL repository="https://github.com/peter-evans/create-pull-request"
|
||||||
@@ -11,8 +11,10 @@ LABEL com.github.actions.color="gray-dark"
|
|||||||
|
|
||||||
COPY LICENSE README.md /
|
COPY LICENSE README.md /
|
||||||
|
|
||||||
|
RUN apk add python3-dev git git-lfs
|
||||||
|
|
||||||
COPY requirements.txt /tmp/
|
COPY requirements.txt /tmp/
|
||||||
RUN pip install --requirement /tmp/requirements.txt
|
RUN pip3 install --requirement /tmp/requirements.txt
|
||||||
|
|
||||||
COPY create-pull-request.py /create-pull-request.py
|
COPY create-pull-request.py /create-pull-request.py
|
||||||
ENTRYPOINT [ "/create-pull-request.py" ]
|
ENTRYPOINT [ "/create-pull-request.py" ]
|
||||||
26
README.md
26
README.md
@@ -3,25 +3,34 @@
|
|||||||
|
|
||||||
A GitHub action to create a pull request for changes to your repository in the actions workspace.
|
A GitHub action to create a pull request for changes to your repository in the actions workspace.
|
||||||
|
|
||||||
Changes to a repository in the actions workspace persist between actions in a workflow.
|
Changes to a repository in the Actions workspace persist between steps in a workflow.
|
||||||
This action is designed to be used in conjunction with other actions that modify or add files to your repository.
|
This action is designed to be used in conjunction with other steps that modify or add files to your repository.
|
||||||
The changes will be automatically committed to a new branch and a pull request created.
|
The changes will be automatically committed to a new branch and a pull request created.
|
||||||
|
|
||||||
Create Pull Request action will:
|
Create Pull Request action will:
|
||||||
|
|
||||||
1. Check for repository changes in the actions workspace. This includes untracked (new) files as well as modified files.
|
1. Check for repository changes in the Actions workspace. This includes untracked (new) files as well as modified files.
|
||||||
2. Commit all changes to a new branch. The commit will be made using the name and email of the `HEAD` commit author.
|
2. Commit all changes to a new branch. The commit will be made using the name and email of the `HEAD` commit author.
|
||||||
3. Create a pull request to merge the new branch into the currently active branch executing the workflow.
|
3. Create a pull request to merge the new branch into the currently active branch executing the workflow.
|
||||||
|
|
||||||
Note: Modifying a repository during workflows is not good practice in general.
|
Note: Modifying a repository during workflows is not good practice in general.
|
||||||
However, this action opens up some interesting possibilities when used carefully.
|
However, this action opens up some interesting possibilities when used carefully.
|
||||||
This action is experimental and may not work well for repositories that have a very high frequency of commits.
|
This action is experimental and may not work well for some use cases.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Linux
|
||||||
```yml
|
```yml
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v1.2.0
|
uses: peter-evans/create-pull-request@v1.2.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
|
Multi platform - Linux, MacOS, Windows (beta)
|
||||||
|
```yml
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v1.2.1-multi
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@@ -31,10 +40,10 @@ This action is experimental and may not work well for repositories that have a v
|
|||||||
These variables are all optional. If not set, a default value will be used.
|
These variables are all optional. If not set, a default value will be used.
|
||||||
|
|
||||||
- `PULL_REQUEST_BRANCH` - The branch name. See **Branch naming** below for details.
|
- `PULL_REQUEST_BRANCH` - The branch name. See **Branch naming** below for details.
|
||||||
|
- `BRANCH_SUFFIX` - The branch suffix type. Valid values are `short-commit-hash` (default) and `timestamp`. See **Branch naming** below for details.
|
||||||
- `COMMIT_MESSAGE` - The message to use when committing changes.
|
- `COMMIT_MESSAGE` - The message to use when committing changes.
|
||||||
- `PULL_REQUEST_TITLE` - The title of the pull request.
|
- `PULL_REQUEST_TITLE` - The title of the pull request.
|
||||||
- `PULL_REQUEST_BODY` - The body of the pull request.
|
- `PULL_REQUEST_BODY` - The body of the pull request.
|
||||||
- `BRANCH_SUFFIX` - Valid values are `short-commit-hash` and `timestamp`. See **Branch naming** below for details.
|
|
||||||
|
|
||||||
The following parameters are available for debugging and troubleshooting.
|
The following parameters are available for debugging and troubleshooting.
|
||||||
|
|
||||||
@@ -52,7 +61,7 @@ create-pull-request/patch-fcdfb59
|
|||||||
create-pull-request/patch-394710b
|
create-pull-request/patch-394710b
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, branches can be suffixed with a timestamp by setting the environment variable `BRANCH_SUFFIX` to the value `timestamp`. This option may be necessary if multiple pull requests will be created during the execution of a workflow.
|
Alternatively, branches can be suffixed with a timestamp by setting the environment variable `BRANCH_SUFFIX` to the value `timestamp`. This option must be used if multiple pull requests will be created during the execution of a workflow.
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
```
|
```
|
||||||
@@ -70,10 +79,11 @@ Here is an example that sets all the main environment variables.
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v1.2.0
|
uses: peter-evans/create-pull-request@v1.2.1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
PULL_REQUEST_BRANCH: my-patches
|
PULL_REQUEST_BRANCH: my-patches
|
||||||
|
BRANCH_SUFFIX: short-commit-hash
|
||||||
COMMIT_MESSAGE: Auto-modify files by my-file-modifier-action
|
COMMIT_MESSAGE: Auto-modify files by my-file-modifier-action
|
||||||
PULL_REQUEST_TITLE: Changes from my-file-modifier-action
|
PULL_REQUEST_TITLE: Changes from my-file-modifier-action
|
||||||
PULL_REQUEST_BODY: This is an auto-generated PR with changes from my-file-modifier-action
|
PULL_REQUEST_BODY: This is an auto-generated PR with changes from my-file-modifier-action
|
||||||
|
|||||||
Reference in New Issue
Block a user