question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting mediaType doesn't work

See original GitHub issue

What version of octokit is used in this action? I’m trying to get the contents of a file in a repository with:

github.rest.repos.getContent({
  owner,
  repo,
  path,
  mediaType: {
    format: "raw+json"
  }
});

but it doesn’t work. I always get the default response as if mediaType isn’t set. Maybe this is not yet supported in the octokit client used in this action?

I looked at the debug information of the request and the headers don’t include an Accept header. I expect the Accept header to be set to application/vnd.github.v3.raw+json

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
avonengelcommented, Apr 27, 2022

I ran into the same issue and was able to work around it like this:

      - name: install npm packages
        run: |
          npm install @octokit/rest @actions/github

      - uses: actions/github-script@v6
        with:
          script: |
            const { Octokit } = require("@octokit/rest");
            const { getOctokitOptions } = require('@actions/github/lib/utils');

            const github2 = new Octokit(getOctokitOptions(process.env.GITHUB_TOKEN));

Of course this is suboptimal, but at least it behaves the same as when run directly via node locally, or from within custom JS actions.

0reactions
starsagar21commented, May 25, 2022

bug level is on march 3 not updating

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Missing Paper / Media Type Selection on Apple OSX
SYMPTOM - Paper sizes missing or custom paper sizes not working. FIX - Remove the Airprint driver and replace with the correct one....
Read more >
Setting a browser's media type - css - Stack Overflow
The simplest way would be to detect the user's screen resolution using Javascript: screen.width and screen.height . If it's too small, ...
Read more >
media - CSS: Cascading Style Sheets - MDN Web Docs
The @media CSS at-rule can be used to apply part of a style sheet based on the result of one or more media...
Read more >
Making Changes to Printer Settings - Epson
The Media Type setting determines what other settings are available, so you should always make this setting first. In the Print dialog box,...
Read more >
Handle content types - Azure Logic Apps - Microsoft Learn
Learn how to handle various content types in workflows during design ... If you're working with JSON data that doesn't specify a header, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found