pascalgn / npm-publish-action

GitHub action to automatically publish packages to npm
MIT License
221 stars 29 forks source link

Can't push tags: `fatal: could not read Username for 'https://github.com': No such device or address` #30

Closed pojntfx closed 3 years ago

pojntfx commented 3 years ago

Hey!

First of all, thanks for the action; it has been very useful so far.

The pushing of tags seems to be broken though:

/usr/bin/docker run --name f7c037418f7a4abcac55ca6d528ce2de_d157fb --label 179394 --workdir /github/workspace --rm -e NPM_CONFIG_USERCONFIG -e NODE_AUTH_TOKEN -e GITHUB_TOKEN -e NPM_AUTH_TOKEN -e INPUT_PUBLISH_COMMAND -e INPUT_COMMIT_PATTERN -e INPUT_PUBLISH_ARGS -e INPUT_TAG_NAME -e INPUT_TAG_MESSAGE -e INPUT_WORKSPACE -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/unisockets/unisockets":"/github/workspace" 179394:f7c037418f7a4abcac55ca6d528ce2de
Found commit: feat: Release 0.0.3
Executing: git rev-parse -q --verify refs/tags/v0.0.3
Executing: git config user.name pojntfx
Executing: git config user.email felix@pojtinger.com
Executing: git tag -a -m v0.0.3 v0.0.3
Executing: git push origin refs/tags/v0.0.3
command failed with code 128
fatal: could not read Username for 'https://github.com': No such device or address
command failed with code 128

(See https://github.com/pojntfx/unisockets/runs/1501948274?check_suite_focus=true)

I've set the env variables correctly (I hope):

name: Yarn CI

on: [push, pull_request]

jobs:
  yarn:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false
      - name: Setup node
        uses: actions/setup-node@v2-beta
        with:
          node-version: "14"
          registry-url: "https://registry.npmjs.org"
      - name: Install dependencies with Yarn
        run: yarn
      - name: Build with make
        run: make -j$(nproc)
      - name: Build with Yarn
        run: yarn build
      - name: Publish to npm
        if: ${{ github.ref == 'refs/heads/main' }}
        uses: pascalgn/npm-publish-action@1.3.5
        with:
          publish_command: "yarn"
          commit_pattern: '.*\:\ Release (\S+)'
          publish_args: "--access public"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
      - name: Publish to GitHub pages
        if: ${{ github.ref == 'refs/heads/main' }}
        uses: JamesIves/github-pages-deploy-action@3.7.1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: gh-pages
          FOLDER: docs
          CLEAN: true

(See https://github.com/pojntfx/unisockets/blob/main/.github/workflows/yarn.yaml)

Any idea what might be going on here? Seems like the push isn't authenticated.

pojntfx commented 3 years ago

Nvm, found the culprit; I removed persist-credentials: false from actions/checkout@v2 and now it works: https://github.com/pojntfx/unisockets/runs/1502001185?check_suite_focus=true