php-actions / composer

Use the Composer CLI in your Github Actions.
174 stars 54 forks source link

"Resource not accessible by integration" error #70

Closed adambiggs closed 1 year ago

adambiggs commented 2 years ago

Trying to get this action working, but I'm seeing "Resource not accessible by integration" errors on every build.

Neither of the fixes mentioned in #39 and #66 worked for me.

Successfully built 165ada25111a
Successfully tagged docker.pkg.github.com/my-org/my-repo/php-actions_composer_my-repo:php-latest-build2
The push refers to repository [docker.pkg.github.com/my-org/my-repo/php-actions_composer_my-repo]
7eba071b370c: Preparing
912d9c054022: Preparing
9310d54608c1: Preparing
5a02989682c4: Preparing
503898301ef3: Preparing
df2f9abed396: Preparing
dcd0ffda58b8: Preparing
c29d319c8043: Preparing
8a76a297762e: Preparing
8d3ac3489996: Preparing
df2f9abed396: Waiting
dcd0ffda58b8: Waiting
c29d319c8043: Waiting
8a76a297762e: Waiting
8d3ac3489996: Waiting
denied: Resource not accessible by integration
Error: Process completed with exit code 1.

This is running on a private repo, using the push event, with the following config:

      - name: Install dependencies
        uses: php-actions/composer@v6
        with:
          args: --prefer-dist --no-interaction --no-progress --working-dir=./path/to/subdirectory
g105b commented 2 years ago

Hi, I'll take a look at this, but I haven't seen the "Resource not accessible by integration" error before. Please take a look at the https://github.com/php-actions/example-composer repository for a reference project that is known to be working. There are various different Actions YML configs in that project that test various different aspects.

Would you be able to please check the permissions under Settings > Actions > Actions permissions ?

enable actions

adambiggs commented 2 years ago

It doesn't seem like I'm doing anything out of the ordinary compared with the example configurations from https://github.com/php-actions/example-composer.

Also I checked the actions permissions on my repo, and while the options are slightly different from your screenshot, the repo has full Actions permissions:

image

g105b commented 2 years ago

OK thanks for the update. I'll take a look into this. Is the repository in question open or closed source, and is it part of an organisation?

adambiggs commented 2 years ago

Yes, the repo is private and is part of an organization.

g105b commented 2 years ago

Please could you check in the organisation's settings page, as there are action-specific permissions in there.

adambiggs commented 2 years ago

Seems like the organization permissions shouldn't be stopping anything either: image

g105b commented 2 years ago

I'll reach out to Github Support for a resolution on this, as I can't replicate the issue, and the error message seems very specific.

Two things to confirm beforehand:

1) I expect I already know the answer to this, but if you re-run the action, this is the same outcome each time? 2) On order to get quick builds, php-actions caches the built images on the target repository (you'll see this under the packages tab on https://github.com/orgs/ORGANISATION_NAME/packages ) - please can you delete any packages from here and try again to rule out a caching issue?

g105b commented 2 years ago

P.S. I would also like to know which php-actions packages are available within your organisation, as I would expect a broken build for whatever reason should not be cached, but I'm not sure.

adambiggs commented 2 years ago
  1. Yes, I saw the same outcome after re-running the action multiple times.
  2. No packages were ever created in the organization packages page.
g105b commented 2 years ago

Thanks for the info, I'm escalating this to Github as it seems to be an actions issue. Will report back here.

courtney-miles commented 2 years ago

I am experiencing the same issue on a public repo.

I am new to Github actions (this is the first I have drafted one) so I'm not confident that the mistake is not mine.

You can see the failing action at https://github.com/frictionlessdata/tableschema-php/runs/4734356485?check_suite_focus=true

I had attempted to use the action from https://github.com/frictionlessdata/datapackage-php/blob/main/.github/workflows/ci.yml verbatim, but it failed with the same error.

To verify the mistake is not mine, I simplified the action as much as I understood how.

name: CI
on:
    push:
        branches: [ main ]
    pull_request:
        branches: [ main ]
jobs:
    build:
        runs-on: ubuntu-latest

        name: frictionlessdata/tableschema-php test

        steps:
            - uses: actions/checkout@v2

            - name: Validate composer.json & composer.lock
              uses: php-actions/composer@v6
              with:
                  command: validate --strict
OriHoch commented 2 years ago

The problem is that the action depends on this bash script which at the end tries to push a docker image to the repository

This depends on a few settings in GitHub, I would suggest to try and remove this dependency and allow to run without pushing a Docker image (via a specific option, or detect it fails and continue anyway)

@adambiggs - I think you should make sure the organization has GitHub packages enabled properly, there are a few settings in the organization level regarding that (which are not included in the screenshots you sent)

@courtney-miles - GitHub limits the permissions of actions running from forks to read-only, so you can't push to the source repository docker registry. I don't think anything can be done about that, just don't run the action from a fork..

g105b commented 2 years ago

Thank you @OriHoch that's really helpful.

Github support have responded to me. Here's their advice:

Could you ask them to create a repo using the following repo template: https://github.com/github-packages-examples/ghcr-publish

This will attempt to publish an image from a GitHub Actions workflow. I'm interested to know if they experience the same error.

So, if you could check the advice above, this will help us get closer to an answer. If you have the same error with the ghcr-publish action, we'll know it's config error as @OriHoch suggests.

courtney-miles commented 2 years ago

Hey @g105b , this is done -- https://github.com/courtney-miles/ghcr-publish-test/actions/workflows/publish.yml

devnix commented 2 years ago

Seems like I'm affected too and I don't have any clue about how to solve this

Niellles commented 2 years ago

I am running into the same error too, on a private repository that is.

I don't see any additional information I could provide to the extensive discussion above. But if, however, I can be of assistance please do let me know.

g105b commented 1 year ago

Can anybody provide me with any help on this issue? I'm not sure how to continue.

OriHoch commented 1 year ago

opened a PR which should fix it - https://github.com/php-actions/php-build/pull/11

g105b commented 1 year ago

Thank you so much, @OriHoch - simple and effective. I'll include it in the next releases.