Giter VIP home page Giter VIP logo

Comments (5)

shawnHartsell avatar shawnHartsell commented on July 19, 2024

Hi @matross-gh thanks for filing an issue! If you could could you let us know what version of actions-sync you encountered this issue in? I noticed that this project is not using matrix build for Windows so it very well could be a Go related issue. We'll work on reproducing the issue internally as well.

from actions-sync.

matross-gh avatar matross-gh commented on July 19, 2024

@shawnHartsell Hi there! Sure thing! I am using GHES Actions Sync v0.2 obtained from issuing the command actions-sync version.

from actions-sync.

shawnHartsell avatar shawnHartsell commented on July 19, 2024

@matross-gh I was able to repro this, and admit should have seen the problem sooner 😢. I believe you're encountering this issue b/c your using http instead of https for --destination-url. Can you update your command and see if that works for you?

Details

When http is used, the REST API returns a 301. Furthermore, the http.Client that's used to create the go-github Client
is configured with the default behavior to follow redirects, which results in a GET being executed to the endpoint instead.

In the case of creating a repo (the last action in the sync command) what actually ends up happening is that repos for the user/org are being fetched. The response body for fetching repos is an array which causes the Marshaling error ([]Repo to Repo)

Below is an example taken from one of my test GHES instance via curl:

curl -v -L \
  -X GET \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer REDACTED" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http://REDACTED/api/v3/orgs/shawnhartsell/repos \
  -d '{"name":"Hello-World","description":"This is your first repository","homepage":"https://github.com","private":false,"has_issues":true,"has_projects":true,"has_wiki":true}'
...
< HTTP/1.1 301 Moved Permanently
< Content-Length: 0
* Please rewind output before next send
< Location: https://REDACTED/api/v3/orgs/shawnhartsell/repos
< connection: close
<
* Closing connection
* Clear auth, redirects to port from 80 to 443
* Issue another request to this URL: 'https://REDACTED/api/v3/orgs/shawnhartsell/repos'
* Switch from POST to GET
* ....TLS STUFF REMOVED FOR BREVITY
> GET /api/v3/orgs/shawnhartsell/repos HTTP/2
> Host: REDACTED
> User-Agent: curl/8.4.0
> Accept: application/vnd.github+json
> X-GitHub-Api-Version: 2022-11-28
>
< HTTP/2 401
< server: GitHub.com
< date: Wed, 17 Apr 2024 16:47:20 GMT
< content-type: application/json; charset=utf-8
< content-length: 135
< x-github-enterprise-version: 3.10.9
{
  "message": "Must authenticate to access this API.",
  "documentation_url": "https://docs.github.com/[email protected]/rest"
}

from actions-sync.

matross-gh avatar matross-gh commented on July 19, 2024

@shawnHartsell Wow! Thank you! That worked! I can't believe I did that! sheesh! Using same version with same tooling on my laptop, no change there.

Command (with HTTPS on --destination-url parameter)
actions-sync sync --cache-dir 'c:\temp' --destination-token 'ghp_abc123' --destination-url 'https://myinstanceFQDN' --repo-name 'docker/bake-action'

Output
image

Pardon the use of ghe-admin, just forming the repeatable process here. I will be using a different account for this action.

Thank you very much and my apologies for such a late reply!

from actions-sync.

shawnHartsell avatar shawnHartsell commented on July 19, 2024

No problem! Glad that resolved your issue. As a follow up I created #128 to force the use of HTTPs. I also noticed that the version command is not outputting correct data so I created #129 as well.

from actions-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.