Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run action on GHES #173

Closed
mvcmania opened this issue Mar 15, 2023 · 9 comments · Fixed by #175
Closed

Can't run action on GHES #173

mvcmania opened this issue Mar 15, 2023 · 9 comments · Fixed by #175
Labels
bug Something isn't working
Milestone

Comments

@mvcmania
Copy link

I have seen the similar problem that was already raised but quite unsure if those are identical so that is why i wanted to report it.
Im receiving the error below.
Screenshot 2023-03-15 at 10 17 13
And here is the my action YML. Please advise.

# Unique name for this workflow
name: Pre-Release PR
# Definition when the workflow should run
on:
  workflow_dispatch:
  pull_request:
    types: [opened, edited, synchronize, reopened]
permissions:
  pull-requests: write
jobs:
  pmd-run:
    runs-on: catalyst
    steps:
      # Now we install nodejs in the VM, and specify version 14
      - uses: actions/setup-node@v3
        with:
          node-version: "14"
      # Install java as it is required for the next step
      - uses: actions/setup-java@v3
        with:
          distribution: "temurin"
          java-version: "8"
      # Checkout the source code
      - name: "Checkout source code"
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      # Run PMD scan
      - name: "Run PMD scan"
        uses: pmd/pmd-github-action@v1.3.0
        id: pmd
        with:
          sourcePath: "force-app"
          rulesets: "ruleset.xml"
          analyzeModifiedFilesOnly:
          createGitHubAnnotations: true

      # Check for PMD violations
      - name: "Check for PMD violations"
        if: steps.pmd.outputs.violations != 0
        run: exit 1
@mvcmania
Copy link
Author

analyzeModifiedFilesOnly : false

@adangel
Copy link
Member

adangel commented Mar 16, 2023

I think the message "Error: Not Found" is the response from github API when determining the latest PMD version.

The action tries to request https://api.github.com/repos/pmd/pmd/releases/latest - which seems to have failed.

We definitely can improve the error message here...

Does this problem persist? Maybe it was just a temporary problem....

@mvcmania
Copy link
Author

mvcmania commented Mar 16, 2023

Hey @adangel thanks for quick response, unfortunately it seems like a persistent but what you have said triggered a point, so im running the github action on enterprise instance where we have self-hosted runners , im suspecting , maybe the endpoint that you mentioned is not reachable under the self-hosted runner. Sounds quite unlikely but , it might be the root cause.

@adnansakel
Copy link

Hi @adangel I could curl the url https://api.github.com/repos/pmd/pmd/releases/latest from our self hosted runner. But we get that Not Found error persistently.

@adangel
Copy link
Member

adangel commented Mar 17, 2023

Hm... I'm having a suspicion, what's happening here: We use the "hydrated" github client from the actions-toolkit. "hydrated" means, it uses not necessarily api.github.com as baseurl, but your GHES url - and on your github enterprise server, there is no pmd/pmd repository.

I think, we use this url: https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/github/src/internal/utils.ts#L23-L25

In case of GHES, the environment variable GITHUB_API_URL will be set and we don't query api.github.com anymore....

@adangel adangel added the bug Something isn't working label Mar 17, 2023
@adangel adangel changed the title Error - Not Found Can't run action on GHES Mar 17, 2023
adangel added a commit to adangel/pmd-github-action that referenced this issue Mar 17, 2023
@adangel adangel added this to the next milestone Mar 17, 2023
@mvcmania
Copy link
Author

Hi @adangel , latest update :)
We have mirrored pmd/pmd repo along with releases and tags into our GHES and we were able to pass ther "Error : NOT found" problem, we ended up another problem though which completely different. Im posting here in case you might need to fix the problem
Screenshot 2023-03-17 at 16 46 43

@mvcmania
Copy link
Author

mvcmania commented Mar 17, 2023

By the way, i have already tried the fix that you have just created, it is working like a charm. Thank you. All errors are gone!

@adangel
Copy link
Member

adangel commented Mar 17, 2023

It seems, the downloaded releases zip file is corrupt. You can try to download manually the URL, that is printed in the debug output (##[debug]Downloading https....) and verify e.g. with zipinfo that this is indeed a PMD releases archive.
You can also compare this file with the one on https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.55.0/pmd-bin-6.55.0.zip

The sha256sum of that file should be 1acf96d43cb40d591cacccc1c20a66fc796eaddf69ea61812594447bac7a11d pmd-bin-6.55.0.zip.

Maybe something went wrong when mirroring pmd/pmd?

Anyway, my PR #175 will use api.github.com to access the latest release.
If you want, you can try out the fix:

- uses: adangel/pmd-github-action@issue-173

@adangel
Copy link
Member

adangel commented Mar 17, 2023

By the way, i have already tried the fix that you have just created, it is working like a charm. Thank you. All errors are gone!

Thanks for testing! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants