AlexSim93 / pull-request-analytics-action

Provides informative reports on team and developer metrics, based on data from pull requests and code reviews
MIT License
110 stars 10 forks source link

Can't see generated report #44

Closed achakote closed 3 months ago

achakote commented 3 months ago

Looks like a dumb question or my brain is not working :( , but after the run I can't see markdown generated. Where should i see it.

Run output -

1m 31s
Run AlexSim93/pull-request-analytics-action@v3
RATE LIMIT REMAINING BEFORE REQUESTS:  4991
Initiating data request.
Batch request #1 out of 4(owner/repo)
Batch request #2 out of 4(owner/repo)
Batch request #3 out of 4(owner/repo)
Batch request #4 out of 4(owner/repo)
Data successfully retrieved. Starting report calculations.
Calculation complete. Generating markdown.
Markdown successfully generated.
RATE LIMIT REMAINING AFTER REQUESTS:  4604
0s
Cleaning up orphan processes

I don't see anything on the run page.

Yaml-


on:
  workflow_dispatch:
    inputs:
      report_date_start:
        description: "Report date start(d/MM/yyyy)"
        required: false
      report_date_end:
        description: "Report date end(d/MM/yyyy)"
        required: false
jobs:
  create-report:
    name: "Create report"
    runs-on: "ubuntu-latest"
    steps:
      - name: "Run script for analytics"
        uses: AlexSim93/pull-request-analytics-action@v3
        with:
          EXECUTION_OUTCOME: markdown
          GITHUB_OWNER_FOR_ISSUE: owner
          GITHUB_REPO_FOR_ISSUE: repo
          GITHUB_TOKEN: ${{ secrets.TOKEN }} 
          GITHUB_OWNERS_REPOS: "owner/repo" 
          TIMEZONE: "Australia/Melbourne"
          REPORT_DATE_START: ${{ inputs.report_date_start }}
          REPORT_DATE_END: ${{ inputs.report_date_end }}```
AlexSim93 commented 3 months ago

If you choose markdown output, you will have access to it in the next step. Then, you can do whatever you want with this string. This is an example of how it might be used in the next step.

      - name: Post comment
        uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2
        with:
          issue-number: 123
          body: |
            # 1/01/2023-31/01/2023

            ${{ steps.analytics.outputs.MARKDOWN }}
achakote commented 3 months ago

Thanks. Can I also add it as Step Summary?

edit. - Got it

achakote commented 3 months ago

@AlexSim93 I tried to echo "${{ steps.analytics.outputs.markdown }}" > report.md file but getting below errors. What would be correct way to handle this?


/home/runner/work/_temp/5e2f1b8d-cc58-4e37-9eea-b09d3bd1da6b.sh: line 124: GITHUB_OWNER_FOR_ISSUE:: command not found
/home/runner/work/_temp/5e2f1b8d-cc58-4e37-9eea-b09d3bd1da6b.sh: line 125: GITHUB_REPO_FOR_ISSUE:: command not found
/home/runner/work/_temp/5e2f1b8d-cc58-4e37-9eea-b09d3bd1da6b.sh: line 126: SHOW_STATS_TYPES:: command not found```
AlexSim93 commented 3 months ago

Could you share your yaml-file without sensitive information of course? I'll try to check the same config in my project and explain it.

achakote commented 3 months ago
on:
  workflow_dispatch:
    inputs:
      report_date_start:
        description: "Report date start(d/MM/yyyy)"
        required: false
      report_date_end:
        description: "Report date end(d/MM/yyyy)"
        required: false
jobs:
  create-report:
    name: "Create report"
    runs-on: "ubuntu-latest"
    steps:
      - name: "Run script for analytics"
        uses: AlexSim93/pull-request-analytics-action@v3
        with:
          EXECUTION_OUTCOME: markdown
          GITHUB_OWNER_FOR_ISSUE: owner
          GITHUB_REPO_FOR_ISSUE: repo
          GITHUB_TOKEN: ${{ secrets.TOKEN }} 
          GITHUB_OWNERS_REPOS: "owner/repo" 
          TIMEZONE: "Australia/Melbourne"
          REPORT_DATE_START: ${{ inputs.report_date_start }}
          REPORT_DATE_END: ${{ inputs.report_date_end }}```
      - name: "Publish"
         run: |
          mkdir -p report
          echo "${{ steps.analytics.outputs.markdown }}" > report/report.md
          cat report/report.md > $GITHUB_STEP_SUMMARY
AlexSim93 commented 3 months ago

This config creates summary without errors

name: "Test action run"
on:
  workflow_dispatch:
    inputs:
      report_date_start:
        description: "Report date start(d/MM/yyyy)"
        required: false
      report_date_end:
        description: "Report date end(d/MM/yyyy)"
        required: false
jobs:
  create-report:
    name: "Create report"
    runs-on: "ubuntu-latest"
    steps:
      - name: "Run script for analytics"
        id: analytics
        uses: AlexSim93/pull-request-analytics-action@v3
        with:
          EXECUTION_OUTCOME: markdown
          GITHUB_TOKEN: ${{ secrets.YOUR_TOKEN }} 
          GITHUB_OWNERS_REPOS: "OWNER/REPO" 
          TIMEZONE: "Australia/Melbourne"
          REPORT_DATE_START: ${{ inputs.report_date_start }}
          REPORT_DATE_END: ${{ inputs.report_date_end }}
      - name: "Publish"
        run: |
          mkdir -p report
          echo "${{ steps.analytics.outputs.markdown }}" > report/report.md
          cat report/report.md >> $GITHUB_STEP_SUMMARY
achakote commented 3 months ago

It generates step summary for me, but if you see carefully, its missing few things.

Do you see any errors in the log?

AlexSim93 commented 3 months ago

The report is generated successfully, except for a few points: charts and code blocks. Errors occur at the publish stage because the markdown contains content (charts, code blocks) that is processed in issues and comments but not supported in the summary.

achakote commented 3 months ago

Got it. Thanks.