Is it possible to give the previous step output as argument to the script?

Open
#183 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
github-actions, javascript, node.js, shell
Domain
ci-cd, cli, release

Research direction

Start with the get-data and release workflow shown in the issue, then inspect package.json and .github/scripts/build.js. Trace how successCmd invokes the script and determine what is needed for the change-log output to reach it; done means the script receives that output during the release workflow.

Written by the indexing model from the issue text.

Description

Can we pass the previous step output as an argument to the script?

get-data:
    runs-on: ubuntu-latest
    outputs:
      change-log: ${{ steps.update-specs.outputs.change-log }}
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Test
        run: |
          echo "::set-output name=change-log::testChange"
  release:
    runs-on: ubuntu-latest
    needs: [get-data]
    steps:
      - name: Checkout repo
        uses: actions/checkout@v2
      - run: |
          git pull
          npm install
      - name: semanticRelease
        run: |
          npm i --save-dev @semantic-release/exec
          npx semantic-release -t \${version}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json:

"plugins": [
        "@semantic-release/commit-analyzer",
        "@semantic-release/release-notes-generator",
      [
        "@semantic-release/changelog",
        {
          "changelogFile": "CHANGES.md"
        }
      ],
      [
        "@semantic-release/npm",
        {
          "npmPublish": false
        }
      ],
      "@semantic-release/github",
      [
        "@semantic-release/git",
        {
          "assets": [
            "CHANGES.md",
            "package.json"
          ],
          "message": "chore(release): set `package.json` to ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
        }
      ],
      [
        "@semantic-release/exec",
        {
          "successCmd": "node .github/scripts/build.js ${nextRelease.version}"  // Here Can we pass the change-log variable of get-data step?
        }
      ]
    ]
Dominant language
JavaScript
Stars
164
Forks
28
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from semantic-release/exec

All issues in semantic-release/exec

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.