adding outputs example (now tested)
Signed-off-by: vsoch <vsochat@stanford.edu>
This commit is contained in:
@@ -74,6 +74,14 @@ An environment variable of course can be referenced as you usually would.
|
||||
| assignees_return_code | Return code for the assignees request | ASSIGNEES_RETURN_CODE |
|
||||
| reviewers_return_code | Return code for the reviewers request | REVIEWERS_RETURN_CODE |
|
||||
|
||||
See the [examples/outputs-example.yml](examples/outputs-example.yml) for how this works.
|
||||
In this example, we can reference `${{ steps.pull_request.outputs.pull_request_url }}`
|
||||
in either another environment variable declaration, or within a run statement to access
|
||||
our variable `pull_request_url` that was generated in a step with id `pull_request`.
|
||||
The screenshot below shows the example in action to interact with outputs in several ways.
|
||||
|
||||

|
||||
|
||||
## Examples
|
||||
|
||||
Example workflows are provided in [examples](examples), and please contribute any
|
||||
|
||||
28
examples/outputs-example.yml
Normal file
28
examples/outputs-example.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Pull Request on Branch Push
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- devel
|
||||
jobs:
|
||||
auto-pull-request:
|
||||
name: PullRequestAction
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: pull-request-action
|
||||
id: pull_request
|
||||
uses: vsoch/pull-request-action@add/outputs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH_PREFIX: "update/"
|
||||
PULL_REQUEST_BRANCH: "master"
|
||||
PULL_REQUEST_REVIEWERS: vsoch
|
||||
- name: Test outputs
|
||||
env:
|
||||
pull_request_number_output: ${{ steps.pull_request.outputs.pull_request_number }}
|
||||
pull_request_url_output: ${{ steps.pull_request.outputs.pull_request_url }}
|
||||
run: |
|
||||
echo "Pull request number from output: ${pull_request_number_output}"
|
||||
echo "Pull request url from output: ${pull_request_url_output}"
|
||||
echo "Pull request number from environment: ${PULL_REQUEST_NUMBER}"
|
||||
echo "Pull request url from environment: ${PULL_REQUEST_URL}"
|
||||
echo "Another way to specify from output ${{ steps.pull_request.outputs.pull_request_number }}"
|
||||
BIN
img/outputs.png
Normal file
BIN
img/outputs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user