Upload test screenshots with unknown name


I’m setting up a CI workflow and I would like to save screenshots of failing builds using the upload-artifacts action.

However the name of the screenshot file is not known beforehands (for instance, it will contain a timestamp) so I cannot hardcode it in the .yml

Is there a way around this problem?

I have looked at this question  https://github.community/t5/GitHub-Actions/GitHub-Actions-Using-non-fixed-names-in-upload-artifact/td-p/43161 but unfortunately the solution is not applicable for my case.

Thank you

Hi @cecilian ,

‘Path’ is required for action ‘actions/upload-artifact’ and not accpet pattern ‘*’. Hence, after you capature the screenshots, you can put them in a subfolder under root, specify the folder as the path value.

- name: Upload screenshots
        uses: actions/upload-artifact@v1
          name: screenshots
          path: ./scr #Put your screenshots in subfolder ./src before upload

Hope it helps!