monodeploy icon indicating copy to clipboard operation
monodeploy copied to clipboard

[plugin-github] Cannot determine GitHub owner or repository

Open gabormagyar opened this issue 2 years ago • 1 comments

Describe the bug

I get this error when I run my publish workflow in one of my repositories. (It is unfortunately private.)

Executing Release Hooks
  ➤ YN0001: │ Error: Cannot determine GitHub owner or repository
      at PluginInternals (/home/runner/work/fnd-configs/fnd-configs/.yarn/cache/@monodeploy-plugin-github-npm-0.4.1-6d7a11f9d2-2fb1a2ef02.zip/node_modules/@monodeploy/plugin-github/lib/plugin.js:29:15)

This same publish workflow works fine in other private repositories, same config and everything.

  • [ ] I am interested in contributing a fix.

To reproduce

I am unable to reproduce this error locally or in Github Actions on another repo

Expected behavior

GitHub plugin publishes a release

Environment (please complete the following information):

  • OS: GitHub Actions Ubuntu 20.04.4 LTS Runner
  • Monodeploy Version: 3.3.0
    • Monodeploy GitHub Plugin Version: 0.6.1
  • Yarn Version: 3.2.3
    • Yarn module linker: pnp
  • Node Version: 16.16.0
  • Git Version: not sure

Additional context

Publish workflow:

name: Publish

on:
  # Whenever manually triggered
  workflow_dispatch: {}
  # And every Tuesday at 6:30 UTC
  schedule:
    - cron: '30 6 * * TUE'

jobs:
  publish:
    name: Publish Packages
    runs-on: ubuntu-latest

    permissions:
      contents: write
      packages: write

    steps:
      - uses: actions/checkout@v3
        with:
          # Need to fetch history, not just current commit
          fetch-depth: 0
          # This workflow currently needs to use the admin PAT token to bypass branch protection rules on push to main
          token: ${{ secrets.PAT }}
      - uses: actions/[email protected]
        with:
          node-version: 16

      - name: Set up commit author
        run: |
          git config --local user.name 'github-actions[bot]'
          git config --local user.email 'github-actions[bot]@users.noreply.github.com'

      - run: yarn
      - run: yarn monodeploy
        env:
          # PAT token needed to publish GitHub releases (contents: write)
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          # Node auth token needed for .yarnrc.yml to be able to access private MBH packages (packages: write)
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Config:

module.exports = {
  preset: 'monodeploy/preset-recommended',
  changesetIgnorePatterns: ['**/test/**'],
  conventionalChangelogConfig: '@tophat/conventional-changelog-config',
  changelogFilename: '<packageDir>/CHANGELOG.md',
  plugins: ['@monodeploy/plugin-github'],
  git: {
    push: true,
  },

  // This only matters for --dry-run
  forceWriteChangeFiles: true,
}

gabormagyar avatar Aug 30 '22 09:08 gabormagyar

Anyway you can share part of your package.json file for your top level workspace? I'm mainly interested in the repository field.

You can also try adding a test case here: https://github.com/tophat/monodeploy/blob/main/packages/git/src/parseRepositoryProperty.test.ts with the format of your repository url to see if the parser logic can handle the format.

noahnu avatar Aug 30 '22 11:08 noahnu

That seemed to have done the trick, added the repo field and it works now. Maybe worth adding a line to the docs, as there's normally no reason for the top level package.json to have the repo field. Thanks for the hint!

gabormagyar avatar Sep 12 '22 08:09 gabormagyar