octokit / request-action

A GitHub Action to send arbitrary requests to GitHub's REST API

Home Page:https://github.com/marketplace/actions/GitHub-API-Request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consistently getting 404

CWSites opened this issue · comments

commented

I've tried many things suggested in the docs both here and through GitHub, answers to issues and this is what I've come up with. No matter what I try nothing works and I still get a 404, even when using curl.

I've noticed that mediaType isn't consistent and appears as if people add in whatever they feel like. I suspect that may be causing an issue, however if that was the case then why are none of the other answers working? I removed the variables and just hard coded since I know which branch my action will be running on.

I also want to point out that we are on GitHub Enterprise and this is a private repo. I am using an access token that has write privileges, NOT a personal access token.

Configuration

    steps:
      - name: Branch protection OFF
        uses: octokit/request-action@v2.0.24
        with:
          route: PUT /repos/digital-ai/dot-components/branches/develop/protection
          mediaType: |
            - Accept: application/vnd.github.v3+json
          required_status_checks: |
            null
          enforce_admins: |
            null
          required_conversation_resolution: |
            null
          required_pull_request_reviews: |
            null
        env:
          GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}

Output

Warning: Unexpected input(s) 'required_status_checks', 'enforce_admins', 'required_conversation_resolution', 'required_pull_request_reviews', valid inputs are ['route', 'mediaType']
Run octokit/request-action@v2.0.24
  with:
    route: PUT /repos/digital-ai/dot-components/branches/develop/protection
    mediaType: {"Accept": application/vnd.github.v3+json}
    required_status_checks: null
  
    enforce_admins: null
  
    required_conversation_resolution: null
  
    required_pull_request_reviews: null
  
  env:
    GITHUB_TOKEN: ***
PUT /repos/digital-ai/dot-components/branches/develop/protection
> mediaType: [object Object]
> required_status_checks: null
> enforce_admins: null
> required_conversation_resolution: null
> required_pull_request_reviews: null
Error: Not Found
commented

Update, I setup my bot to have admin rights and now it seems to be working for the most part, I'm now getting an error

Warning: Unexpected input(s) 'required_status_checks', 'enforce_admins', 'required_conversation_resolution', 'required_pull_request_reviews', valid inputs are ['route', 'mediaType']
Run octokit/request-action@v2.0.24
PUT /repos/digital-ai/dot-components/branches/develop/protection
> mediaType: [object Object]
> required_status_checks: null
> enforce_admins: null
> required_conversation_resolution: null
> required_pull_request_reviews: null
Error: Invalid request.

"restrictions" wasn't supplied.
commented

Alrighty, it's all working now, for more details I have a thread here: https://github.community/t/branch-protection-api-returning-404/217405/10