Compare commits

..

8 Commits

Author SHA1 Message Date
4c95214a9b Update README 2019-11-16 09:27:21 +09:00
b37c0a038c Update input description 2019-11-16 09:26:07 +09:00
d9841567d1 Update README 2019-11-16 09:25:06 +09:00
2cce94bfb0 Bump version 2019-11-16 09:25:00 +09:00
d968e8b11b Add warning and fail gracefully when ref is invalid for base 2019-11-16 09:24:46 +09:00
6c73093f9b Merge pull request #74 from peter-evans/renovate/gitpython-3.x
Update dependency GitPython to v3.0.5
2019-11-15 19:46:46 +09:00
d17c882ef3 Update examples 2019-11-15 08:27:12 +09:00
d5f4e48a66 Update dependency GitPython to v3.0.5 2019-11-14 01:46:43 +00:00
8 changed files with 47 additions and 36 deletions

View File

@ -46,7 +46,7 @@ These inputs are *all optional*. If not set, sensible default values will be use
| `team-reviewers` | A comma separated list of GitHub teams to request a review from. | none |
| `milestone` | The number of the milestone to associate this pull request with. | none |
| `branch` | The branch name. See **Branch naming** below for details. | `create-pull-request/patch` |
| `base` | Overrides the base branch. **Use with caution!** | Defaults to the currently checked out branch. |
| `base` | Sets the pull request base branch. | Defaults to the currently checked out branch, `GITHUB_REF`. For `pull_request` events, `GITHUB_HEAD_REF` |
| `branch-suffix` | The branch suffix type. Valid values are `short-commit-hash`, `timestamp`, `random` and `none`. See **Branch naming** below for details. | `short-commit-hash` |
**Outputs**

View File

@ -27,7 +27,7 @@ inputs:
branch:
description: 'The pull request branch name.'
base:
description: 'Overrides the base branch.'
description: 'Sets the pull request base branch.'
branch-suffix:
description: 'The branch suffix type.'
outputs:

View File

@ -217,9 +217,13 @@ elif github_ref.startswith('refs/pull/'):
"Removing the merge commit by switching to the pull request head branch '%s'" %
base)
checkout_branch(repo.git, True, base)
else:
elif github_ref.startswith('refs/heads/'):
base = github_ref[11:]
print("Currently checked out base assumed to be branch '%s'" % base)
else:
print(f"::warning::Currently checked out ref '{github_ref}' is not a valid base for a pull request. " +
"Unable to continue. Exiting.")
sys.exit()
# Skip if the current branch is a PR branch created by this action.
# This may occur when using a PAT instead of GITHUB_TOKEN because

View File

@ -1,2 +1,2 @@
GitPython==3.0.4
GitPython==3.0.5
PyGithub==1.44.1

View File

@ -336,39 +336,42 @@ Alternatively, [`set-env`](https://help.github.com/en/github/automating-your-wor
### Debugging GitHub Actions
#### Runner Diagnostic Logging
[Runner diagnostic logging](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/managing-a-workflow-run#enabling-runner-diagnostic-logging) provides additional log files that contain information about how a runner is executing an action.
To enable runner diagnostic logging, set the secret `ACTIONS_RUNNER_DEBUG` to `true` in the repository that contains the workflow.
#### Step Debug Logging
To enable [step debug logging](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/managing-a-workflow-run#enabling-step-debug-logging) set the secret `ACTIONS_STEP_DEBUG` to `true` in the repository that contains the workflow.
[Step debug logging](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/managing-a-workflow-run#enabling-step-debug-logging) increases the verbosity of a job's logs during and after a job's execution.
To enable step debug logging set the secret `ACTIONS_STEP_DEBUG` to `true` in the repository that contains the workflow.
#### Output Various Contexts
```yml
- name: Dump event JSON
env:
EVENT_JSON_FILENAME: ${{ github.event_path }}
run: cat "$EVENT_JSON_FILENAME"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
```

View File

@ -1,6 +1,6 @@
{
"name": "create-pull-request",
"version": "1.7.3",
"version": "1.7.4",
"description": "Creates a pull request for changes to your repository in the actions workspace",
"main": "index.js",
"scripts": {

View File

@ -217,9 +217,13 @@ elif github_ref.startswith('refs/pull/'):
"Removing the merge commit by switching to the pull request head branch '%s'" %
base)
checkout_branch(repo.git, True, base)
else:
elif github_ref.startswith('refs/heads/'):
base = github_ref[11:]
print("Currently checked out base assumed to be branch '%s'" % base)
else:
print(f"::warning::Currently checked out ref '{github_ref}' is not a valid base for a pull request. " +
"Unable to continue. Exiting.")
sys.exit()
# Skip if the current branch is a PR branch created by this action.
# This may occur when using a PAT instead of GITHUB_TOKEN because

View File

@ -1,2 +1,2 @@
GitPython==3.0.4
GitPython==3.0.5
PyGithub==1.44.1