Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
a319015452 | |||
df0d07269b | |||
2aa04baf2e | |||
d29f1e9296 | |||
8ee12880b0 | |||
8d39de8771 | |||
c202684c92 | |||
e970adccb4 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
__pycache__
|
||||
.python-version
|
||||
|
||||
node_modules
|
||||
|
||||
.DS_Store
|
||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -1012,13 +1012,15 @@ async function run() {
|
||||
core.debug(`src: ${src}`);
|
||||
|
||||
// Setup Python from the tool cache
|
||||
setupPython("3.8.1", "x64");
|
||||
setupPython("3.8.x", "x64");
|
||||
|
||||
// Install requirements
|
||||
await exec.exec("pip", [
|
||||
"install",
|
||||
"--requirement",
|
||||
`${src}/requirements.txt`
|
||||
`${src}/requirements.txt`,
|
||||
"--no-index",
|
||||
`--find-links=${__dirname}/vendor`
|
||||
]);
|
||||
|
||||
// Fetch action inputs
|
||||
|
2
dist/src/create_or_update_pull_request.py
vendored
2
dist/src/create_or_update_pull_request.py
vendored
@ -72,6 +72,8 @@ def create_or_update_pull_request(
|
||||
pull_request = github_repo.get_pulls(
|
||||
state="open", base=base, head=head_branch
|
||||
)[0]
|
||||
# Update title and body
|
||||
pull_request.as_issue().edit(title=title, body=body)
|
||||
print(f"Updated pull request #{pull_request.number} ({branch} => {base})")
|
||||
else:
|
||||
print(str(e))
|
||||
|
BIN
dist/vendor/Deprecated-1.2.7.tar.gz
vendored
Normal file
BIN
dist/vendor/Deprecated-1.2.7.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/GitPython-3.0.5.tar.gz
vendored
Normal file
BIN
dist/vendor/GitPython-3.0.5.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/PyGithub-1.45.tar.gz
vendored
Normal file
BIN
dist/vendor/PyGithub-1.45.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/PyJWT-1.7.1.tar.gz
vendored
Normal file
BIN
dist/vendor/PyJWT-1.7.1.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/certifi-2019.11.28.tar.gz
vendored
Normal file
BIN
dist/vendor/certifi-2019.11.28.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/chardet-3.0.4.tar.gz
vendored
Normal file
BIN
dist/vendor/chardet-3.0.4.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/gitdb2-2.0.6.tar.gz
vendored
Normal file
BIN
dist/vendor/gitdb2-2.0.6.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/idna-2.8.tar.gz
vendored
Normal file
BIN
dist/vendor/idna-2.8.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/requests-2.22.0.tar.gz
vendored
Normal file
BIN
dist/vendor/requests-2.22.0.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/six-1.14.0.tar.gz
vendored
Normal file
BIN
dist/vendor/six-1.14.0.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/smmap2-2.0.5.tar.gz
vendored
Normal file
BIN
dist/vendor/smmap2-2.0.5.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/urllib3-1.25.8.tar.gz
vendored
Normal file
BIN
dist/vendor/urllib3-1.25.8.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/wrapt-1.11.2.tar.gz
vendored
Normal file
BIN
dist/vendor/wrapt-1.11.2.tar.gz
vendored
Normal file
Binary file not shown.
@ -9,6 +9,7 @@ This document covers terminology, how the action works, and general usage guidel
|
||||
- [Providing a consistent base](#providing-a-consistent-base)
|
||||
- [Pull request events](#pull-request-events)
|
||||
- [Restrictions on forked repositories](#restrictions-on-forked-repositories)
|
||||
- [Tag push events](#tag-push-events)
|
||||
|
||||
## Terminology
|
||||
|
||||
@ -105,3 +106,68 @@ jobs:
|
||||
# Check if the event is not triggered by a fork
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
```
|
||||
|
||||
### Tag push events
|
||||
|
||||
An `on: push` workflow will also trigger when tags are pushed.
|
||||
During these events, the `actions/checkout` action will check out the `ref/tags/<tag>` git ref by default.
|
||||
This means the repository will *not* be checked out on an active branch.
|
||||
|
||||
If you would like to run `create-pull-request` action on the tagged commit you can achieve this by creating a temporary branch as follows.
|
||||
|
||||
```yml
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
jobs:
|
||||
example:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Create a temporary tag branch
|
||||
run: |
|
||||
git config --global user.name 'GitHub'
|
||||
git config --global user.email 'noreply@github.com'
|
||||
git checkout -b temp-${GITHUB_REF:10}
|
||||
git push --set-upstream origin temp-${GITHUB_REF:10}
|
||||
|
||||
- name: Create changes to pull request
|
||||
run: <create changes here>
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
base: master
|
||||
|
||||
- name: Delete tag branch
|
||||
run: |
|
||||
git push --delete origin temp-${GITHUB_REF:10}
|
||||
```
|
||||
|
||||
This is an alternative, simpler workflow to the one above. However, this is not guaranteed to checkout the tagged commit.
|
||||
There is a chance that in between the tag being pushed and checking out the `master` branch in the workflow, another commit is made to `master`. If that possibility is not a concern, this workflow will work fine.
|
||||
|
||||
```yml
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
jobs:
|
||||
example:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Create changes to pull request
|
||||
run: <create changes here>
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
@ -258,7 +258,7 @@ jobs:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: autopep8
|
||||
id: autopep8
|
||||
uses: peter-evans/autopep8@v1.1.0
|
||||
uses: peter-evans/autopep8@v1
|
||||
with:
|
||||
args: --exit-code --recursive --in-place --aggressive --aggressive .
|
||||
- name: Set autopep8 branch name
|
||||
|
6
index.js
6
index.js
@ -10,13 +10,15 @@ async function run() {
|
||||
core.debug(`src: ${src}`);
|
||||
|
||||
// Setup Python from the tool cache
|
||||
setupPython("3.8.1", "x64");
|
||||
setupPython("3.8.x", "x64");
|
||||
|
||||
// Install requirements
|
||||
await exec.exec("pip", [
|
||||
"install",
|
||||
"--requirement",
|
||||
`${src}/requirements.txt`
|
||||
`${src}/requirements.txt`,
|
||||
"--no-index",
|
||||
`--find-links=${__dirname}/vendor`
|
||||
]);
|
||||
|
||||
// Fetch action inputs
|
||||
|
@ -4,7 +4,10 @@
|
||||
"description": "Creates a pull request for changes to your repository in the actions workspace",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"package": "ncc build index.js -o dist"
|
||||
"clean": "rm -rf dist",
|
||||
"build": "ncc build index.js -o dist",
|
||||
"vendor-deps": "pip download -r src/requirements.txt --no-binary=:all: -d dist/vendor",
|
||||
"package": "npm run build && npm run vendor-deps"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -72,6 +72,8 @@ def create_or_update_pull_request(
|
||||
pull_request = github_repo.get_pulls(
|
||||
state="open", base=base, head=head_branch
|
||||
)[0]
|
||||
# Update title and body
|
||||
pull_request.as_issue().edit(title=title, body=body)
|
||||
print(f"Updated pull request #{pull_request.number} ({branch} => {base})")
|
||||
else:
|
||||
print(str(e))
|
||||
|
Reference in New Issue
Block a user