algolia / shipjs

Take control of what is going to be your next release.
https://community.algolia.com/shipjs/
MIT License
766 stars 30 forks source link

Make release:trigger compatible with `GITHUB_TOKEN` #598

Closed kazupon closed 4 years ago

kazupon commented 4 years ago

Describe the bug Unfortunately, GITHUB_TOKEN cannot be used to authenticate git commands: In my github action workflow, it could not release with release:trigger. 😞

The following error occurred in the GitHub action workflow:

}
    at exec (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs-lib/dist/index.esm.js:1700:11)
    at default (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/util/run.js:22:20)
    at refs.forEach.ref (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/helper/gitPush.js:23:7)
    at Array.forEach (<anonymous>)
    at gitPush (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/helper/gitPush.js:22:10)
    at runStep (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/step/release/gitPush.js:15:7)
    at runStep (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/step/runStep.js:11:10)
    at default (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/step/release/gitPush.js:7:3)
    at release (/home/runner/work/poeditor-service-provider/poeditor-service-provider/node_modules/shipjs/src/flow/release.js:54:3)
    at process._tickCallback (internal/process/next_tick.js:68:7)

See the https://github.com/kazupon/poeditor-service-provider/runs/377176890

To Reproduce Steps to reproduce the behavior:

  1. create the PR with release:prepare (https://github.com/kazupon/poeditor-service-provider/pull/36)
  2. Label it with release
  3. Merge it
  4. Triggers release workflow with github action, and run the release:trigger (https://github.com/kazupon/poeditor-service-provider/commit/3dace81b5cc45dbf16e8b56758e027104d37c43b/checks?check_suite_id=387723670)

Environment (please complete the following information):

Additional context

jeetiss commented 4 years ago

Hi @kazupon Actually this is bug in github actions that fixed in current version, but as I see you run v1 actions https://github.com/kazupon/poeditor-service-provider/blob/master/.github/workflows/release.yml#L14-L15

All work nice with latest version of github actions https://github.com/jeetiss/try-shipjs/commit/dc141c3bda63f5ff68a868458f71ed90c9510522/checks?check_suite_id=388868397

If you wanna use v1 actions, you can add custom secret GH_TOKEN and replace original token with them in actions as workaround:

      - run: npm run release:trigger
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
kazupon commented 4 years ago

@jeetiss Thanks! I'll try to it with master version, when I'll plan to release. :)