diff --git a/README.md b/README.md index 2dde4ae..926d8ea 100644 --- a/README.md +++ b/README.md @@ -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. + +![img/outputs.png](img/outputs.png) + ## Examples Example workflows are provided in [examples](examples), and please contribute any diff --git a/examples/outputs-example.yml b/examples/outputs-example.yml new file mode 100644 index 0000000..44c9a6f --- /dev/null +++ b/examples/outputs-example.yml @@ -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 }}" diff --git a/img/outputs.png b/img/outputs.png new file mode 100644 index 0000000..0a35648 Binary files /dev/null and b/img/outputs.png differ