fjogeleit / yaml-update-action

Update YAML property with dynamic values

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: HttpError: Not Found

gboie opened this issue · comments

commented

I am getting this error when trying to use it...
(node:1615) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Hey, are you change the file of another repository? Then be sure that the github token has permissions to access and commit to this repository

commented

Hi @fjogeleit , it is in the same repository. Thank you

Do you have some sort of protection rules against the branch you are changing? Can you provide some example how you use the action?

I would try to use a custom github token with the required permission and check if it works.

I had the same issue. @gboie Try to specify organization name like "repository: org/repo". It works for me.

Thanks @tslavik that worked for me as well!

Hello!

I'm having this exact same error and maybe you guys might be able to point me in the right direction.
I've created a token and authorized it to access my organization via SSO Configuration.

My step looks like this

      - name: Update deploy.yaml 📄
        uses: fjogeleit/yaml-update-action@master
        with:
          valueFile: '.github/workflows/dev/k8s/30-application.yaml'
          propertyPath: 'spec.template.spec.containers.0.image'
          value: ${{  needs.build.outputs.image }}
          repository: organization/RepositoryName
          branch: ${{ needs.build.outputs.branch }}
          targetBranch: ${{ needs.build.outputs.branch }}
          updateFile: true
          createPR: false
          commitChange: true
          message: 'Update Image to 1.0.1' #To replace later
          token: ${{ secrets.TOKEN_GITHUB }}

And I get this output

(node:1580) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Error: HttpError: Not Found

Can you provide the previous steps like the checkout of the target repository?

If you push into another repository be sure that you also checkout the target repository in another folder and to point the action to this folder (see workDir).

Sure thing @fjogeleit !

All the steps for this workflow looks like this

      - name: Checkout 
        uses: actions/checkout@v2

      - name: Update deploy.yaml 
        uses: fjogeleit/yaml-update-action@master
        with:
          valueFile: '.github/workflows/dev/k8s/30-application.yaml'
          propertyPath: 'spec.template.spec.containers.0.image'
          value: ${{  needs.build.outputs.image }}
          repository: organization/RepositoryName
          branch: ${{ needs.build.outputs.branch }}
          targetBranch: ${{ needs.build.outputs.branch }}
          updateFile: true
          createPR: false
          commitChange: true
          message: 'Update Image to 1.0.1' #To replace later
          token: ${{ secrets.TOKEN_GITHUB }}

As simple as it gets :P

Everything is done in the same repository

Added: to further explain, this is a deploy workflow, that depends on other workflow called build that basically builds, test and push to docker registry the image. I then wanted to trigger a step where it would change a yaml file for my k8s solution

If the workflow pushes to the same repository it is configured in, you should be able to remove token and repository and use the defaults. Because the default token has permissions to push in the same repository.

If the workflow pushes to the same repository it is configured in, you should be able to remove token and repository and use the defaults. Because the default token has permissions to push in the same repository.

If I remove the token I get Error: HttpError: Resource not accessible by integration

Okay, I see - this is really a permissions problem in your case.

Your custom token is a generated "Personal Access Token" with the permissions to write to the (private?) repo in your organization, right?

Okay, I see - this is really a permissions problem in your case.

Your custom token is a generated "Personal Access Token" with the permissions to write to the (private?) repo in your organization, right?

That is correct, I've selected all scopes under repo just in case. The rest of the scope has nothing to do with writing in repos as far as I can tell

Did you also select the top option "repo"? Thats required to access private Repositories.

Did you also select the top option "repo"? Thats required to access private Repositories.

Yes

image

Hm okay, thats really strange. Because thats just the response of Github thats not much I can improve like logging. You could manually test if you are able to push to the repo with your custom token.

Did you try to remove only the repository value with your custom token?

Hm okay, thats really strange. Because thats just the response of Github thats not much I can improve like logging. You could manually test if you are able to push to the repo with your custom token.

Did you try to remove only the repository value with your custom token?

If I remove the repository value the same error pops up Error: HttpError: Not Found

Later today i'll also attempt to push with my token via cli :)

Okay, thank you. I updated the dependencies in case there is some API change that does not work. I have no really ideas left what the issue could be :-/

I think to test the token manually would be my next step because that was often the problem in other cases.

To see If I was getting problems updating the yaml or commiting I've separated both actions onto 2 different steps. I've found out that It was when commiting.

It seems that GitHub won't allow pushs to .github/workflows path via action, so i've moved my yaml files out of workflows and now it's working ok :)

Great news! Thanks for the feedback