GitHub Actions share file from repo

Hey all, I have integrated my Postman testing into Github Actions which is working well enough so far.

I am using Global Functions to save code and up until now this was fine as it was in a Pre-Request Script at the top most level of the collection.

I now need it to be external so we don’t duplicate code, so I was thinking of storing in the GitHub Repo that runs the CI every night. I found this article which alludes to what I might need. Can I use this to output the string of text / file that I need to bring into postman? continuous integration - Github actions share workspace/artifacts between jobs? - Stack Overflow

As I quick test I set it up like this in postman:

const url = 'http://localhost:3000/globalFuncs_v2024.02.29.js';
const fileContent = response.text();
pm.globals.set('globalFuncs', fileContent);
eval(fileContent);

So I want to know if I can connect the two, using GitHub to pass the string/file out (so I don’t need to login to github inside postman) and then ingesting it into postman at the top level collection pre-request script level so I can use it for all tests moving forward.

Or better yet, am I overcomplicating this and there is an easier way?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.