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

Job summary can't find resources for JSON to MD #18

Closed
1 task done
B-Interactive opened this issue Sep 12, 2022 · 11 comments · Fixed by #27
Closed
1 task done

Job summary can't find resources for JSON to MD #18

B-Interactive opened this issue Sep 12, 2022 · 11 comments · Fixed by #27
Labels
help wanted Extra attention is needed type:question Further information is requested.
Milestone

Comments

@B-Interactive
Copy link

B-Interactive commented Sep 12, 2022

Describe your question

Using the Display the linting result in the GitHub Actions summary example, I was able to successfully set up an action that tests my repository.

However, it looks to be failing with a 404 Not Found error when trying to convert JSON to MD, at the Job Summary creation step.

Have I missed (or misunderstood) a step somewhere?

Run npx --yes github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@10up%2fphpcs-json-to-md - Not found
npm ERR! 404 
npm ERR! 404  '@10up/phpcs-json-to-md@1.0.0' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-09-12T07_11_35_065Z-debug-0.log
Error: Process completed with exit code 1.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@B-Interactive B-Interactive added the type:question Further information is requested. label Sep 12, 2022
@jeffpaul
Copy link
Member

@dinhtungdu I'm guessing this is because the 10up/phpcs-json-to-md project isn't published to npm, yeah?

@dinhtungdu
Copy link

@B-Interactive can you please share the configuration you're using so we can look at it further?

@jeffpaul I don't think so as in the example, we use github:10up/phpcs-json-to-md to install the package directly from GitHub.

@jeffpaul jeffpaul added the needs:feedback This requires feedback to determine next steps. label Sep 22, 2022
@WEBzaytsev
Copy link

I use the same configuration (https://github.com/10up/wpcs-action#display-the-linting-result-in-the-github-actions-summary )
The same mistake

@B-Interactive
Copy link
Author

@dinhtungdu, this is the configuration I was using, that produced the error. It is a slightly modified version of the example here:

name: WPCS check

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:

jobs:
  phpcs:
      name: WPCS
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - name: WPCS check
          uses: 10up/wpcs-action@stable
          with:
            standard: 'WordPress'
            extra_args: '--report-json=./phpcs.json'
        - name: Update summary
          run: |
            npx --yes github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
            cat phpcs.md >> $GITHUB_STEP_SUMMARY
          if: always()

@github-actions github-actions bot removed the needs:feedback This requires feedback to determine next steps. label Sep 27, 2022
@dinhtungdu
Copy link

@B-Interactive @WEBzaytsev thanks so much for your report, I can reproduce the issue on my local. Can you please try setting the node version to 14 to see if it fixes the issue? Look like people reported this this issue too: npm/cli#5134

name: WPCS check

on: pull_request

jobs:
  phpcs:
      name: VIPCS
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - uses: actions/setup-node@v3
          with:
            node-version: 14
        - name: VIPCS check
          uses: 10up/wpcs-action@stable
          with:
            standard: 'WordPress-VIP-Go'
            extra_args: '--report-json=./phpcs.json'
        - name: Update summary
          run: |
            npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
            cat phpcs.md >> $GITHUB_STEP_SUMMARY
          if: always()

@B-Interactive
Copy link
Author

B-Interactive commented Sep 29, 2022

Thanks @dinhtungdu, that is working.

It did take more than 13 minutes at the Update summary step. I'm not sure if that's expected.

image

@dinhtungdu
Copy link

dinhtungdu commented Sep 29, 2022

It did take more than 13 minutes at the Update summary step. I'm not sure if that's expected.

@B-Interactive It's definitely unexpected, the npx installation took so long. @jeffpaul I think we need to create a stable branch and push the built command there to speedup the installation.

@jeffpaul
Copy link
Member

jeffpaul commented Oct 6, 2022

@iamdharmesh Tung's note above might be something worth researching in your next spin through OSS time.

@iamdharmesh
Copy link
Member

Hi @jeffpaul, npx installation takes too long because of npm v6 (Node 14 comes with npm v6). I tried with Node 16 and it only takes 2s-4s to Update the summary. Using Node 16 will fix this issue.

As npx no longer works with github: in latest version of Node 16 (As mentioned by @dinhtungdu here), We can use github:10up/phpcs-json-to-md by install it (instead of using on-the-fly by npx) OR we can use specific node version(16.16.0) before this npx bug was introduced. Sample yml content is given below for both possible options.

  • Use node-version 16.16.0
steps:
      - name: Checkout
        uses: actions/checkout@v2

      - uses: actions/setup-node@v3
        with:
          node-version: 16.16.0

      - name: WPCS check
        uses: 10up/wpcs-action@stable
        with:
          standard: 'WordPress'
          extra_args: '--report-json=./phpcs.json'

      - name: Update summary
        run: |
          npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
          cat phpcs.md >> $GITHUB_STEP_SUMMARY
        if: always()

OR

  • Use github:10up/phpcs-json-to-md by install it (instead of using on-the-fly by npx)
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'npm'

      - name: WPCS check
        uses: 10up/wpcs-action@stable
        with:
          standard: 'WordPress'
          extra_args: '--report-json=./phpcs.json'

      - name: Update summary
        run: |
          npm i -g github:10up/phpcs-json-to-md
          phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
          cat phpcs.md >> $GITHUB_STEP_SUMMARY
        if: always()

I think we need to create a stable branch and push the built command there to speedup the installation.

@dinhtungdu @jeffpaul as this issue is with the old version of npm only, I think it's fine to keep 10up/phpcs-json-to-md as it is, what do think?

Thanks

@jeffpaul
Copy link
Member

@iamdharmesh I think I'm in favor of the approach using github:10up/phpcs-json-to-md.

@jeffpaul jeffpaul added the help wanted Extra attention is needed label Mar 20, 2023
@jeffpaul jeffpaul added this to the Future Release milestone Mar 20, 2023
@iamdharmesh
Copy link
Member

Thanks for the feedback @jeffpaul PR raised for the same.

@jeffpaul jeffpaul modified the milestones: Future Release, 1.5.0 Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type:question Further information is requested.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants