GithubHelp home page GithubHelp logo

Comments (10)

Sicness avatar Sicness commented on June 19, 2024 1

@peter-evans , So, I created the token with contents: write and now it works. Thank you. The only comment from my side that it would be good to add a comment that in some cases it will be required to specify a token even if the target workflow in the same repo. For example when the initial workflow is triggered by on.push.branches.
Thanks!

from repository-dispatch.

BrunoJuchli avatar BrunoJuchli commented on June 19, 2024 1

Just to make it crystal clear: using a fine-grained PAT to notify a different repository works.
Two people on my team (me one of them) tested this independently on two different repos.

from repository-dispatch.

peter-evans avatar peter-evans commented on June 19, 2024 1

@BrunoJuchli Thank you for confirming and raising a PR to update the readme.

Fine-grained PAT usage is now documented here: https://github.com/peter-evans/repository-dispatch#token

from repository-dispatch.

peter-evans avatar peter-evans commented on June 19, 2024

Hi @SamuelLarkin

Are you using a fine-grained PAT? They are in beta and may not work for all GitHub APIs yet. Please try with a "classic" PAT.

(The deprecation warning is not the cause of the error)

from repository-dispatch.

Sicness avatar Sicness commented on June 19, 2024

I have the same issue.

  - name: Trigger develop env deployment
    uses: peter-evans/[email protected]
    with:
      event-type: develop_commit
      client-payload: '{"version": "${{ steps.long_version.outputs.LONG_VERSION }}"}'

Run peter-evans/[email protected]
Error: Resource not accessible by integration
Deprecation: [@octokit/request-error] error.code is deprecated, use error.status.
at RequestError.get (/home/runner/work/_actions/peter-evans/repository-dispatch/v2.1.1/dist/index.js:4221:21)
at hasErrorStatus (/home/runner/work/_actions/peter-evans/repository-dispatch/v2.1.1/dist/index.js:43:25)
at /home/runner/work/_actions/peter-evans/repository-dispatch/v2.1.1/dist/index.js:71:17
at Generator.throw ()
at rejected (/home/runner/work/_actions/peter-evans/repository-dispatch/v2.1.1/dist/index.js:32:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

PAT is not used because the target workflow in the same repo.

from repository-dispatch.

peter-evans avatar peter-evans commented on June 19, 2024

Hi @Sicness

Your case is different. Error: Resource not accessible by integration often occurs when the workflow is being run in a pull request triggered by a fork. Is that how you are executing this?

When using the default GITHUB_TOKEN in this way the maximum permission it can have is read.
https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

from repository-dispatch.

Sicness avatar Sicness commented on June 19, 2024

Hi @peter-evans , thanks for the response.

The initial workflow is triggered by a push into the repo. My goal is to build the app on new commits in a branch and trigger deployment workflow from the first workflow. Looks like in that case I'll have to specify token? It's not obvious from the README :)

from repository-dispatch.

peter-evans avatar peter-evans commented on June 19, 2024

@Sicness It's difficult to say without seeing your workflow.

Are you specifying contents: write permission for the default token in your workflow?

permissions:
  contents: write

e.g. https://github.com/peter-evans/repository-dispatch/blob/main/.github/workflows/ci.yml#LL14C1-L16C18

from repository-dispatch.

AltFreq07 avatar AltFreq07 commented on June 19, 2024

Thanks adding content write fixed my fine grained token issue too

from repository-dispatch.

SamuelLarkin avatar SamuelLarkin commented on June 19, 2024

@peter-evans Yes, I'm using a fine-grained PAT.

from repository-dispatch.

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.