Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running this action on Gitea #75

Closed
chocolatkey opened this issue Oct 25, 2024 · 2 comments
Closed

Running this action on Gitea #75

chocolatkey opened this issue Oct 25, 2024 · 2 comments

Comments

@chocolatkey
Copy link

When attempting to run this action using Gitea actions on a private Gitea instance, the action fails:

Using buf (1.45.0) found in $PATH
[command]/opt/homebrew/bin/buf registry login buf.build --token-stdin
Logged in as chocolatkey. Credentials saved to /Users/mayo/.netrc.
[command]/opt/homebrew/bin/buf config ls-modules --format name
buf.build/kintsugi/kinproto
[command]/opt/homebrew/bin/buf build --error-format github-actions
[command]/opt/homebrew/bin/buf push --error-format github-actions --exclude-unnamed --git-metadata --create
Usage:
  buf push <source> [flags]
Flags:
      [...OMMITTED FOR BREVITY...]
Failure: unable to determine source control URL for this repository; only GitHub/GitLab/BitBucket are supported
::error::Failed push

This seems to come from https://github.com/bufbuild/buf/blob/main/private/buf/cmd/buf/command/push/push.go#L496 . Is there any way to get this running on Gitea? I don't see why using a platform aside from GitHub/GitLab/BitBucket should block using buf push --error-format github-actions --exclude-unnamed --git-metadata --create

@emcfarlane
Copy link
Collaborator

emcfarlane commented Oct 25, 2024

Hey @chocolatkey , this is an issue with the how the --git-metadata resolves the label name and source control URL. Currently buf only supports the registries listed. To workaround this issue you can invoke the push step using a custom run section:

- uses: bufbuild/buf-action@v1
  with:
    token: ${{ secrets.BUF_TOKEN }}
    push: false  # Disable push to customize git metadata
- if: ${{ github.event_name == 'push' }}
  env:
    BRANCH_NAME: ${{ github.ref_name }}
    SOURCE_CONTROL_URL: ${{ github.event.head_commit.url }}
  run: |
    buf push --error-format github-actions --exclude-unnamed --create \
      --label $BRANCH_NAME \
      --source-control-url $SOURCE_CONTROL_URL

Setting the --label and --source-control-url flags manually will avoid the git registry issue. Let me know if that works for you.

@chocolatkey
Copy link
Author

@emcfarlane thanks for the solution, that seems to have worked. For Gitea, I replaced the github instances with gitea. So:

- uses: bufbuild/buf-action@v1
  with:
    token: ${{ secrets.BUF_TOKEN }}
    push: false  # Disable push to customize git metadata
- if: ${{ gitea.event_name == 'push' }}
  env:
    BRANCH_NAME: ${{ gitea.ref_name }}
    SOURCE_CONTROL_URL: ${{ gitea.event.head_commit.url }}
  run: |
    buf push --error-format github-actions --exclude-unnamed --create \
      --label $BRANCH_NAME \
      --source-control-url $SOURCE_CONTROL_URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants