mgrybyk-org / allure-report-branch-js-action

Allure Report with history per branch (JS)
https://mgrybyk-org.github.io/allure-report-branch-js-action/
MIT License
3 stars 2 forks source link

Push reports to gh-pages with github run_number #8

Closed shwetankverma closed 8 months ago

shwetankverma commented 8 months ago

I tried latest action version :

- name: Checkout gh-pages
        uses: actions/checkout@v3
        if: always()
        continue-on-error: true
        with:
          ref: gh-pages # branch name
          path: gh-pages-dir # checkout path

      - name: Allure Report Action
        uses: mgrybyk/allure-report-branch-js-action@v1.1.1
        if: always()
        continue-on-error: true
        id: allure # used in comment to PR
        with:
          report_id: 'self-test'
          gh_pages: 'gh-pages-dir'
          report_dir: 'allure-raw'

      - name: Git Commit and Push Action
        uses: mgrybyk/git-commit-pull-push-action@v1.2.3
        if: always()
        with:
          repository: gh-pages-dir
          branch: gh-pages
          pull_args: --rebase -X ours

Now the thing is, when I used simple-elf/allure-report-action@master and peaceiris/actions-gh-pages@v2, the report was pushed to gh-pages branch into a folder which is ${{ github.run_number }}- image

and I can access the report as report-url/ ${{ github.run_number }}

But through this new approach, the report is being to gh-pages branch into a folder like /allure-js-action/sv-selfhosted/self-test/7752762443_1706860034355 7752762443_1706860034355 is runUniqueId Can I achieve to push the report to a folder with ${{ github.run_number }}, so that report can be accessed same way as before?

@mgrybyk

shwetankverma commented 8 months ago

As I can see from the logs, reports are being pushed at location -> gh-pages-dir\allure-js-action{branchName}{report_id}{runUniqueId}

Instead of this, can you enable to push the reports at {run_number}. This will be very helpful.

mgrybyk commented 8 months ago

@shwetankverma sorry to say it's not possible at the moment due to github actions limitations. The run number is not unique and can change at any time.

Do you have some other suggestions except of using the run_number? How is it causing issues to your setup? Is there anything else I can do to improve user experience of the action?

shwetankverma commented 8 months ago

As per logs I can see - Report successfully generated to gh-pages-dir\allure-js-action\sv-selfhosted\self-test\7754961509_1706872755856 where -- report_id: 'self-test', runUniqueId: '7754961509_1706872755856' branchName: 'sv-selfhosted',

runUniqueId: '7754961509_1706872755856' which is nothing but GITHUB_RUNID1706872755856.

in further steps, i need to navigate to this folder, github run id I can fetch dynamically, but what is this 1706872755856? How can I fetch this? how can I fetch runUniqueId ?

mgrybyk commented 8 months ago

That part is timestamp. I can add runUniqueId to action outputs so that you can use it next steps.

If you have other ideas on how to generate runUniqueId that would be actually unique please let me know.

May I also ask what is the reason you want to navigate to the run folder?

shwetankverma commented 8 months ago

I need to navigate to parse the the report -

- name: Parse Allure Report
  id: parse-allure-report
  run: |
    $report = Get-Content allure-report/widgets/summary.json -Raw | ConvertFrom-Json

Please inform once you add runUniqueId into the output.

mgrybyk commented 8 months ago

Ah, I see. I use that file as well to generate the allure history in this action https://mgrybyk.github.io/allure-report-branch-js-action/allure-js-action/main/self-test/

I've just released a new version v1.1.2 where I added run_unique_id and report_path to outputs.

You can use it like this steps.self_test.outputs.run_unique_id

Can you please let me know if that helps?

shwetankverma commented 8 months ago

@mgrybyk I tried this and solved my issue. Thanks a lot for the quick response and coming up with the solution. I would be happy if gh-pages push happening to run_number. in simple-elf action its happening to run_number.