← github actions
Views:
Passing data to next steps
In cases where we need to pass some information from one step to next step, we can do it as follows with the help of @actions/core
name: Passing data between steps
on: [push]
jobs:
passing-data-between-steps:
runs-on: ubuntu-latest
steps:
- name: Passing data between steps
id: step-1
uses: actions/github-script@v6
with:
script: |
const authorName = context.payload.head_commit.author.name;
core.setOutput("authorMsg", `The author of this is ${authorName}`);
- name: Print author message
run: echo ${{ steps.step-1.outputs.authorMsg }}
Result
Following is the output for the above workflow-

Previousworkflow context