Keep env var output for backwards compat

This commit is contained in:
Peter Evans 2020-07-16 19:42:19 +09:00
parent 3c32fac1fe
commit 5429e57002
4 changed files with 15 additions and 9 deletions

View file

@ -33,9 +33,8 @@ jobs:
branch: example-patches
request-to-parent: false
- name: Check outputs
- name: Check output
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
- name: Add reaction

View file

@ -62,7 +62,7 @@ All inputs are **optional**. If not set, sensible default values will be used.
### Action outputs
The pull request number is output as both an environment variable and a step output.
The pull request number is output as a step output.
Note that in order to read the step output the action step must have an id.
```yml
@ -71,7 +71,6 @@ Note that in order to read the step output the action step must have an id.
uses: peter-evans/create-pull-request@v2
- name: Check outputs
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
```
@ -184,8 +183,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create report file
- name: Make changes to pull request
run: date +%s > report.txt
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v2
@ -209,9 +210,9 @@ jobs:
draft: false
branch: example-patches
request-to-parent: false
- name: Check outputs
- name: Check output
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
```

5
dist/index.js vendored
View file

@ -8084,8 +8084,11 @@ class GitHubHelper {
const headBranch = `${headRepo.owner.login}:${inputs.branch}`;
// Create or update the pull request
const pullNumber = yield this.createOrUpdate(inputs, baseRepository, headBranch);
// Set output
// Set outputs
core.startGroup('Setting outputs');
core.setOutput('pull-request-number', pullNumber);
core.exportVariable('PULL_REQUEST_NUMBER', pullNumber);
core.endGroup();
// Set milestone, labels and assignees
const updateIssueParams = {};
if (inputs.milestone) {

View file

@ -103,8 +103,11 @@ export class GitHubHelper {
headBranch
)
// Set output
// Set outputs
core.startGroup('Setting outputs')
core.setOutput('pull-request-number', pullNumber)
core.exportVariable('PULL_REQUEST_NUMBER', pullNumber)
core.endGroup()
// Set milestone, labels and assignees
const updateIssueParams = {}