Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d3b0a48ef | ||
|
|
e9a825aacd | ||
|
|
3509fd45ae | ||
|
|
14ee9d1df2 | ||
|
|
5d969a55c1 | ||
|
|
44130f6fc9 | ||
|
|
86ccd8cdef | ||
|
|
7e7fa32a5f | ||
|
|
5f7beeb2ff | ||
|
|
926d56fcba | ||
|
|
8d744a2cd3 | ||
|
|
c2d829c681 | ||
|
|
d77392faf0 | ||
|
|
ccd2b64012 | ||
|
|
58fb221778 | ||
|
|
7a856e8b5d | ||
|
|
65d7a66451 | ||
|
|
44a7f59b6f | ||
|
|
8acaf6bb4c | ||
|
|
498d78cb23 |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -32,6 +32,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: action.yml
|
||||||
|
path: action.yml
|
||||||
|
|
||||||
test:
|
test:
|
||||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
|
||||||
@@ -49,6 +53,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
|
- if: matrix.target == 'built' || github.event_name == 'pull_request'
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: action.yml
|
||||||
|
path: .
|
||||||
|
|
||||||
- name: Create change
|
- name: Create change
|
||||||
run: date +%s > report.txt
|
run: date +%s > report.txt
|
||||||
|
|||||||
9
.github/workflows/slash-command-dispatch.yml
vendored
9
.github/workflows/slash-command-dispatch.yml
vendored
@@ -9,8 +9,7 @@ jobs:
|
|||||||
- name: Slash Command Dispatch
|
- name: Slash Command Dispatch
|
||||||
uses: peter-evans/slash-command-dispatch@v1
|
uses: peter-evans/slash-command-dispatch@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
||||||
reaction-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
config: >
|
config: >
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -34,5 +33,11 @@ jobs:
|
|||||||
"command": "cpr-example",
|
"command": "cpr-example",
|
||||||
"permission": "admin",
|
"permission": "admin",
|
||||||
"issue_type": "issue"
|
"issue_type": "issue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "rebase",
|
||||||
|
"permission": "admin",
|
||||||
|
"repository": "peter-evans/slash-command-dispatch-processor",
|
||||||
|
"issue_type": "pull-request"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
29
README.md
29
README.md
@@ -55,10 +55,10 @@ All inputs are **optional**. If not set, sensible default values will be used.
|
|||||||
| `project` | *Deprecated*. See [Create a project card](#create-a-project-card) for details. | |
|
| `project` | *Deprecated*. See [Create a project card](#create-a-project-card) for details. | |
|
||||||
| `project-column` | *Deprecated*. See [Create a project card](#create-a-project-card) for details. | |
|
| `project-column` | *Deprecated*. See [Create a project card](#create-a-project-card) for details. | |
|
||||||
| `draft` | Create a [draft pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests). | `false` |
|
| `draft` | Create a [draft pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests). | `false` |
|
||||||
| `branch` | The branch name. See [Branch naming](#branch-naming) for details. | `create-pull-request/patch` |
|
| `branch` | The branch name. See [Action behaviour](#action-behaviour) for details. | `create-pull-request/patch` |
|
||||||
| `request-to-parent` | Create the pull request in the parent repository of the checked out fork. See [push pull request branches to a fork](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork) for details. | `false` |
|
| `request-to-parent` | Create the pull request in the parent repository of the checked out fork. See [push pull request branches to a fork](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork) for details. | `false` |
|
||||||
| `base` | Sets the pull request base branch. | Defaults to the branch checked out in the workflow. |
|
| `base` | Sets the pull request base branch. | Defaults to the branch checked out in the workflow. |
|
||||||
| `branch-suffix` | The branch suffix type. Valid values are `random`, `timestamp` and `short-commit-hash`. See [Branch naming](#branch-naming) for details. | |
|
| `branch-suffix` | The branch suffix type. Valid values are `random`, `timestamp` and `short-commit-hash`. See [Action behaviour](#action-behaviour) for details. | |
|
||||||
|
|
||||||
### Action outputs
|
### Action outputs
|
||||||
|
|
||||||
@@ -86,20 +86,29 @@ If there is some reason you need to use `actions/checkout@v1` the following step
|
|||||||
- run: git checkout "${GITHUB_REF:11}"
|
- run: git checkout "${GITHUB_REF:11}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Branch naming
|
### Action behaviour
|
||||||
|
|
||||||
For branch naming there are two strategies. Create a fixed-name pull request branch that will be updated with new changes until it is merged or closed, OR, always create a new unique branch each time there are changes to be committed.
|
The default behaviour of the action is to create a pull request that will be continually updated with new changes until it is merged or closed.
|
||||||
|
Changes are committed and pushed to a fixed-name branch, the name of which can be configured with the `branch` input.
|
||||||
|
Any subsequent changes will be committed to the *same* branch and reflected in the open pull request.
|
||||||
|
|
||||||
#### Strategy A - Create and update a pull request branch (default)
|
How the action behaves:
|
||||||
|
|
||||||
This strategy is the default behaviour of the action. The input `branch` defaults to `create-pull-request/patch`. Changes will be committed to this branch and a pull request created. Any subsequent changes will be committed to the *same* branch and reflected in the open pull request. If the pull request is merged or closed a new one will be created. If subsequent changes cause the branch to no longer differ from the base the pull request will be automatically closed and the branch deleted.
|
- If there are changes (i.e. a diff exists with the checked out base branch), the changes will be pushed to a new `branch` and a pull request created.
|
||||||
|
- If there are no changes (i.e. no diff exists with the checked out base branch), no pull request will be created and the action exits silently.
|
||||||
|
- If a pull request already exists and there are no further changes (i.e. no diff with the current pull request branch) then the action exits silently.
|
||||||
|
- If a pull request exists and new changes on the base branch make the pull request unnecessary (i.e. there is no longer a diff between the base and pull request branch), the pull request is automatically closed and the branch deleted.
|
||||||
|
|
||||||
#### Strategy B - Always create a new pull request branch
|
For further details about how the action works and usage guidelines, see [Concepts, guidelines and advanced usage](docs/concepts-guidelines.md).
|
||||||
|
|
||||||
For this strategy there are three options to suffix the branch name.
|
#### Alternative strategy - Always create a new pull request branch
|
||||||
The branch name is defined by the input `branch` and defaults to `create-pull-request/patch`. The following options are values for `branch-suffix`.
|
|
||||||
|
|
||||||
- `random` - Commits will be made to a branch suffixed with a random alpha-numeric string. This option should be used if multiple pull requests will be created during the execution of a workflow. e.g. `create-pull-request/patch-6qj97jr`, `create-pull-request/patch-5jrjhvd`
|
For some use cases it *may* be desirable to always create a new unique branch each time there are changes to be committed.
|
||||||
|
This strategy is not recommended and mainly kept for backwards compatibility.
|
||||||
|
|
||||||
|
To use this strategy, set input `branch-suffix` with one of the following options.
|
||||||
|
|
||||||
|
- `random` - Commits will be made to a branch suffixed with a random alpha-numeric string. e.g. `create-pull-request/patch-6qj97jr`, `create-pull-request/patch-5jrjhvd`
|
||||||
|
|
||||||
- `timestamp` - Commits will be made to a branch suffixed by a timestamp. e.g. `create-pull-request/patch-1569322532`, `create-pull-request/patch-1569322552`
|
- `timestamp` - Commits will be made to a branch suffixed by a timestamp. e.g. `create-pull-request/patch-1569322532`, `create-pull-request/patch-1569322552`
|
||||||
|
|
||||||
|
|||||||
29
__test__/entrypoint.sh
Executable file
29
__test__/entrypoint.sh
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh -l
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Save the working directory
|
||||||
|
WORKINGDIR=$PWD
|
||||||
|
|
||||||
|
# Serve remote repo
|
||||||
|
mkdir /git
|
||||||
|
git init --bare /git/test-repo.git
|
||||||
|
git daemon --verbose --enable=receive-pack --base-path=/git --export-all /git/test-repo.git &>/dev/null &
|
||||||
|
|
||||||
|
# Give the daemon time to start
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Clone and make an initial commit
|
||||||
|
git clone git://127.0.0.1/test-repo.git /git/test-repo
|
||||||
|
cd /git/test-repo
|
||||||
|
git config --global user.email "you@example.com"
|
||||||
|
git config --global user.name "Your Name"
|
||||||
|
echo "#test-repo" > README.md
|
||||||
|
git add .
|
||||||
|
git commit -m "initial commit"
|
||||||
|
git push -u
|
||||||
|
|
||||||
|
# Restore the working directory
|
||||||
|
cd $WORKINGDIR
|
||||||
|
|
||||||
|
# Execute integration tests
|
||||||
|
jest int
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
import * as path from 'path'
|
|
||||||
import {
|
import {
|
||||||
ConfigOption,
|
|
||||||
getRepoPath,
|
getRepoPath,
|
||||||
execGit,
|
execGit,
|
||||||
addConfigOption,
|
addConfigOption,
|
||||||
@@ -15,7 +13,7 @@ const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE']
|
|||||||
describe('git tests', () => {
|
describe('git tests', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
// GitHub workspace
|
// GitHub workspace
|
||||||
process.env['GITHUB_WORKSPACE'] = __dirname
|
process.env['GITHUB_WORKSPACE'] = '/git/test-repo'
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
@@ -26,14 +24,7 @@ describe('git tests', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test('getRepoPath', async () => {
|
it('successfully executes a git command', async () => {
|
||||||
expect(getRepoPath()).toEqual(process.env['GITHUB_WORKSPACE'])
|
|
||||||
expect(getRepoPath('foo')).toEqual(
|
|
||||||
path.resolve(process.env['GITHUB_WORKSPACE'] || '', 'foo')
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('execGit', async () => {
|
|
||||||
const repoPath = getRepoPath()
|
const repoPath = getRepoPath()
|
||||||
const result = await execGit(
|
const result = await execGit(
|
||||||
repoPath,
|
repoPath,
|
||||||
@@ -75,13 +66,13 @@ describe('git tests', () => {
|
|||||||
expect(unset).toBeTruthy()
|
expect(unset).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('configOptionExists returns true', async () => {
|
it('determines that a config option exists', async () => {
|
||||||
const repoPath = getRepoPath()
|
const repoPath = getRepoPath()
|
||||||
const result = await configOptionExists(repoPath, 'remote.origin.url')
|
const result = await configOptionExists(repoPath, 'remote.origin.url')
|
||||||
expect(result).toBeTruthy()
|
expect(result).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('configOptionExists returns false', async () => {
|
it('determines that a config option does not exist', async () => {
|
||||||
const repoPath = getRepoPath()
|
const repoPath = getRepoPath()
|
||||||
const result = await configOptionExists(repoPath, 'this.key.does.not.exist')
|
const result = await configOptionExists(repoPath, 'this.key.does.not.exist')
|
||||||
expect(result).toBeFalsy()
|
expect(result).toBeFalsy()
|
||||||
26
__test__/git.unit.test.ts
Normal file
26
__test__/git.unit.test.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import * as path from 'path'
|
||||||
|
import {getRepoPath} from '../lib/git'
|
||||||
|
|
||||||
|
const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE']
|
||||||
|
|
||||||
|
describe('git tests', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
// GitHub workspace
|
||||||
|
process.env['GITHUB_WORKSPACE'] = __dirname
|
||||||
|
})
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
// Restore GitHub workspace
|
||||||
|
delete process.env['GITHUB_WORKSPACE']
|
||||||
|
if (originalGitHubWorkspace) {
|
||||||
|
process.env['GITHUB_WORKSPACE'] = originalGitHubWorkspace
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
test('getRepoPath', async () => {
|
||||||
|
expect(getRepoPath()).toEqual(process.env['GITHUB_WORKSPACE'])
|
||||||
|
expect(getRepoPath('foo')).toEqual(
|
||||||
|
path.resolve(process.env['GITHUB_WORKSPACE'] || '', 'foo')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
23
__test__/integration-tests.sh
Executable file
23
__test__/integration-tests.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
IMAGE="cpr-integration-tests:latest"
|
||||||
|
ARG1=${1:-}
|
||||||
|
|
||||||
|
if [[ "$(docker images -q $IMAGE 2> /dev/null)" == "" || $ARG1 == "build" ]]; then
|
||||||
|
echo "Building Docker image $IMAGE ..."
|
||||||
|
|
||||||
|
cat > Dockerfile << EOF
|
||||||
|
FROM node:12-alpine
|
||||||
|
RUN apk --no-cache add git git-daemon
|
||||||
|
RUN npm install jest --global
|
||||||
|
WORKDIR /cpr
|
||||||
|
COPY __test__/entrypoint.sh /entrypoint.sh
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
docker build -t $IMAGE .
|
||||||
|
rm Dockerfile
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker run -v $PWD:/cpr $IMAGE
|
||||||
2
dist/cpr/common.py
vendored
2
dist/cpr/common.py
vendored
@@ -11,7 +11,7 @@ def get_random_string(length=7, chars=string.ascii_lowercase + string.digits):
|
|||||||
def parse_github_repository(url):
|
def parse_github_repository(url):
|
||||||
# Parse the protocol and github repository from a URL
|
# Parse the protocol and github repository from a URL
|
||||||
# e.g. HTTPS, peter-evans/create-pull-request
|
# e.g. HTTPS, peter-evans/create-pull-request
|
||||||
https_pattern = re.compile(r"^https://github.com/(.+/.+)$")
|
https_pattern = re.compile(r"^https://.*@?github.com/(.+/.+)$")
|
||||||
ssh_pattern = re.compile(r"^git@github.com:(.+/.+).git$")
|
ssh_pattern = re.compile(r"^git@github.com:(.+/.+).git$")
|
||||||
|
|
||||||
match = https_pattern.match(url)
|
match = https_pattern.match(url)
|
||||||
|
|||||||
2
dist/cpr/requirements.txt
vendored
2
dist/cpr/requirements.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
setuptools==46.2.0
|
setuptools==46.4.0
|
||||||
wheel==0.34.2
|
wheel==0.34.2
|
||||||
GitPython==3.1.2
|
GitPython==3.1.2
|
||||||
PyGithub==1.51
|
PyGithub==1.51
|
||||||
|
|||||||
6
dist/cpr/test_common.py
vendored
6
dist/cpr/test_common.py
vendored
@@ -16,6 +16,12 @@ def test_parse_github_repository_success():
|
|||||||
assert protocol == "HTTPS"
|
assert protocol == "HTTPS"
|
||||||
assert repository == "peter-evans/create-pull-request"
|
assert repository == "peter-evans/create-pull-request"
|
||||||
|
|
||||||
|
protocol, repository = cmn.parse_github_repository(
|
||||||
|
"https://xxx:x-oauth-basic@github.com/peter-evans/create-pull-request"
|
||||||
|
)
|
||||||
|
assert protocol == "HTTPS"
|
||||||
|
assert repository == "peter-evans/create-pull-request"
|
||||||
|
|
||||||
protocol, repository = cmn.parse_github_repository(
|
protocol, repository = cmn.parse_github_repository(
|
||||||
"git@github.com:peter-evans/create-pull-request.git"
|
"git@github.com:peter-evans/create-pull-request.git"
|
||||||
)
|
)
|
||||||
|
|||||||
6
dist/index.js
vendored
6
dist/index.js
vendored
@@ -4861,14 +4861,16 @@ function bytesToUuid(buf, offset) {
|
|||||||
var i = offset || 0;
|
var i = offset || 0;
|
||||||
var bth = byteToHex;
|
var bth = byteToHex;
|
||||||
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
||||||
return ([bth[buf[i++]], bth[buf[i++]],
|
return ([
|
||||||
|
bth[buf[i++]], bth[buf[i++]],
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
bth[buf[i++]], bth[buf[i++]], '-',
|
bth[buf[i++]], bth[buf[i++]], '-',
|
||||||
bth[buf[i++]], bth[buf[i++]],
|
bth[buf[i++]], bth[buf[i++]],
|
||||||
bth[buf[i++]], bth[buf[i++]],
|
bth[buf[i++]], bth[buf[i++]],
|
||||||
bth[buf[i++]], bth[buf[i++]]]).join('');
|
bth[buf[i++]], bth[buf[i++]]
|
||||||
|
]).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = bytesToUuid;
|
module.exports = bytesToUuid;
|
||||||
|
|||||||
BIN
dist/vendor/certifi-2020.4.5.1.tar.gz
vendored
BIN
dist/vendor/certifi-2020.4.5.1.tar.gz
vendored
Binary file not shown.
BIN
dist/vendor/certifi-2020.6.20.tar.gz
vendored
Normal file
BIN
dist/vendor/certifi-2020.6.20.tar.gz
vendored
Normal file
Binary file not shown.
BIN
dist/vendor/requests-2.23.0.tar.gz
vendored
BIN
dist/vendor/requests-2.23.0.tar.gz
vendored
Binary file not shown.
BIN
dist/vendor/requests-2.24.0.tar.gz
vendored
Normal file
BIN
dist/vendor/requests-2.24.0.tar.gz
vendored
Normal file
Binary file not shown.
Binary file not shown.
@@ -241,7 +241,9 @@ jobs:
|
|||||||
image: alpine
|
image: alpine
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: apk --no-cache add git python3
|
run: |
|
||||||
|
apk --no-cache add git python3
|
||||||
|
python3 -m ensurepip
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
- [Keep a branch up-to-date with another](#keep-a-branch-up-to-date-with-another)
|
- [Keep a branch up-to-date with another](#keep-a-branch-up-to-date-with-another)
|
||||||
- [Use case: Create a pull request to update X periodically](#use-case-create-a-pull-request-to-update-x-periodically)
|
- [Use case: Create a pull request to update X periodically](#use-case-create-a-pull-request-to-update-x-periodically)
|
||||||
- [Update NPM dependencies](#update-npm-dependencies)
|
- [Update NPM dependencies](#update-npm-dependencies)
|
||||||
|
- [Update Gradle dependencies](#update-gradle-dependencies)
|
||||||
- [Update SwaggerUI for GitHub Pages](#update-swaggerui-for-github-pages)
|
- [Update SwaggerUI for GitHub Pages](#update-swaggerui-for-github-pages)
|
||||||
- [Spider and download a website](#spider-and-download-a-website)
|
- [Spider and download a website](#spider-and-download-a-website)
|
||||||
- [Use case: Create a pull request to update X by calling the GitHub API](#use-case-create-a-pull-request-to-update-x-by-calling-the-github-api)
|
- [Use case: Create a pull request to update X by calling the GitHub API](#use-case-create-a-pull-request-to-update-x-by-calling-the-github-api)
|
||||||
@@ -144,6 +145,44 @@ jobs:
|
|||||||
- run: npm run build
|
- run: npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Update Gradle dependencies
|
||||||
|
|
||||||
|
The following workflow will create a pull request for Gradle dependencies.
|
||||||
|
It requires first configuring your project to use Gradle lockfiles.
|
||||||
|
See [here](https://github.com/peter-evans/gradle-auto-dependency-updates) for how to configure your project and use the following workflow.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
name: Update Dependencies
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 1 * * 1'
|
||||||
|
jobs:
|
||||||
|
update-dep:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Perform dependency resolution and write new lockfiles
|
||||||
|
run: ./gradlew dependencies --write-locks
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT }}
|
||||||
|
commit-message: Update dependencies
|
||||||
|
title: Update dependencies
|
||||||
|
body: |
|
||||||
|
- Dependency updates
|
||||||
|
|
||||||
|
Auto-generated by [create-pull-request][1]
|
||||||
|
|
||||||
|
[1]: https://github.com/peter-evans/create-pull-request
|
||||||
|
branch: update-dependencies
|
||||||
|
```
|
||||||
|
|
||||||
### Update SwaggerUI for GitHub Pages
|
### Update SwaggerUI for GitHub Pages
|
||||||
|
|
||||||
When using [GitHub Pages to host Swagger documentation](https://github.com/peter-evans/swagger-github-pages), this workflow updates the repository with the latest distribution of [SwaggerUI](https://github.com/swagger-api/swagger-ui).
|
When using [GitHub Pages to host Swagger documentation](https://github.com/peter-evans/swagger-github-pages), this workflow updates the repository with the latest distribution of [SwaggerUI](https://github.com/swagger-api/swagger-ui).
|
||||||
|
|||||||
3703
package-lock.json
generated
3703
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,9 @@
|
|||||||
"format": "prettier --write '**/*.ts'",
|
"format": "prettier --write '**/*.ts'",
|
||||||
"format-check": "prettier --check '**/*.ts'",
|
"format-check": "prettier --check '**/*.ts'",
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"test": "jest --passWithNoTests",
|
"test:unit": "jest unit",
|
||||||
|
"test:int": "__test__/integration-tests.sh",
|
||||||
|
"test": "npm run test:unit && npm run test:int",
|
||||||
"pack-assets": "mkdir -p dist/cpr && cp -rv src/cpr/* dist/cpr",
|
"pack-assets": "mkdir -p dist/cpr && cp -rv src/cpr/* dist/cpr",
|
||||||
"vendor-deps": "pip download -r src/cpr/requirements.txt --no-binary=:all: -d dist/vendor",
|
"vendor-deps": "pip download -r src/cpr/requirements.txt --no-binary=:all: -d dist/vendor",
|
||||||
"package": "npm run build && npm run pack-assets && npm run vendor-deps"
|
"package": "npm run build && npm run pack-assets && npm run vendor-deps"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ def get_random_string(length=7, chars=string.ascii_lowercase + string.digits):
|
|||||||
def parse_github_repository(url):
|
def parse_github_repository(url):
|
||||||
# Parse the protocol and github repository from a URL
|
# Parse the protocol and github repository from a URL
|
||||||
# e.g. HTTPS, peter-evans/create-pull-request
|
# e.g. HTTPS, peter-evans/create-pull-request
|
||||||
https_pattern = re.compile(r"^https://github.com/(.+/.+)$")
|
https_pattern = re.compile(r"^https://.*@?github.com/(.+/.+)$")
|
||||||
ssh_pattern = re.compile(r"^git@github.com:(.+/.+).git$")
|
ssh_pattern = re.compile(r"^git@github.com:(.+/.+).git$")
|
||||||
|
|
||||||
match = https_pattern.match(url)
|
match = https_pattern.match(url)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
setuptools==46.2.0
|
setuptools==46.4.0
|
||||||
wheel==0.34.2
|
wheel==0.34.2
|
||||||
GitPython==3.1.2
|
GitPython==3.1.2
|
||||||
PyGithub==1.51
|
PyGithub==1.51
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ def test_parse_github_repository_success():
|
|||||||
assert protocol == "HTTPS"
|
assert protocol == "HTTPS"
|
||||||
assert repository == "peter-evans/create-pull-request"
|
assert repository == "peter-evans/create-pull-request"
|
||||||
|
|
||||||
|
protocol, repository = cmn.parse_github_repository(
|
||||||
|
"https://xxx:x-oauth-basic@github.com/peter-evans/create-pull-request"
|
||||||
|
)
|
||||||
|
assert protocol == "HTTPS"
|
||||||
|
assert repository == "peter-evans/create-pull-request"
|
||||||
|
|
||||||
protocol, repository = cmn.parse_github_repository(
|
protocol, repository = cmn.parse_github_repository(
|
||||||
"git@github.com:peter-evans/create-pull-request.git"
|
"git@github.com:peter-evans/create-pull-request.git"
|
||||||
)
|
)
|
||||||
|
|||||||
22
src/git.ts
22
src/git.ts
@@ -50,7 +50,11 @@ export async function execGit(
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addConfigOption(repoPath, name, value): Promise<boolean> {
|
export async function addConfigOption(
|
||||||
|
repoPath: string,
|
||||||
|
name: string,
|
||||||
|
value: string
|
||||||
|
): Promise<boolean> {
|
||||||
const result = await execGit(
|
const result = await execGit(
|
||||||
repoPath,
|
repoPath,
|
||||||
['config', '--local', '--add', name, value],
|
['config', '--local', '--add', name, value],
|
||||||
@@ -60,8 +64,8 @@ export async function addConfigOption(repoPath, name, value): Promise<boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function unsetConfigOption(
|
export async function unsetConfigOption(
|
||||||
repoPath,
|
repoPath: string,
|
||||||
name,
|
name: string,
|
||||||
valueRegex = '.'
|
valueRegex = '.'
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const result = await execGit(
|
const result = await execGit(
|
||||||
@@ -73,8 +77,8 @@ export async function unsetConfigOption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function configOptionExists(
|
export async function configOptionExists(
|
||||||
repoPath,
|
repoPath: string,
|
||||||
name,
|
name: string,
|
||||||
valueRegex = '.'
|
valueRegex = '.'
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const result = await execGit(
|
const result = await execGit(
|
||||||
@@ -86,8 +90,8 @@ export async function configOptionExists(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getConfigOption(
|
export async function getConfigOption(
|
||||||
repoPath,
|
repoPath: string,
|
||||||
name,
|
name: string,
|
||||||
valueRegex = '.'
|
valueRegex = '.'
|
||||||
): Promise<ConfigOption> {
|
): Promise<ConfigOption> {
|
||||||
const option = new ConfigOption()
|
const option = new ConfigOption()
|
||||||
@@ -102,8 +106,8 @@ export async function getConfigOption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getAndUnsetConfigOption(
|
export async function getAndUnsetConfigOption(
|
||||||
repoPath,
|
repoPath: string,
|
||||||
name,
|
name: string,
|
||||||
valueRegex = '.'
|
valueRegex = '.'
|
||||||
): Promise<ConfigOption> {
|
): Promise<ConfigOption> {
|
||||||
if (await configOptionExists(repoPath, name, valueRegex)) {
|
if (await configOptionExists(repoPath, name, valueRegex)) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import * as semver from 'semver'
|
|||||||
* @param {string} versionSpec version of Python
|
* @param {string} versionSpec version of Python
|
||||||
* @param {string} arch architecture (x64|x32)
|
* @param {string} arch architecture (x64|x32)
|
||||||
*/
|
*/
|
||||||
export function setupPython(versionSpec, arch): Promise<void> {
|
export function setupPython(versionSpec: string, arch: string): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user