Context
I'm developing a GitHub Action that allows managing Repositories Issues based on my company policies (like greeting the user, changing the tags based on interactions and sending messages to Ryver
's Chat when it is required).
For the sake of simplicity, lets call the used Repositories as:
Repo Act
: The repository where the action is stored (and releases are made)Repo Use
: The repository where the action is being used (and where the issues are created, and so on)Actions
So far, to test the changes made in the Repo Act
, I have to:
Repo Act
. Implement the logic and push itRepo Act
. Make a release of the action (e.g: v1.1.3)Repo Use
. Change the Action version, to use the new version of Repo Act
(e.g: v1.1.3)Repo Use
. Create an issue and trigger the actionThis process takes way to long. I'm looking for a way to test it locally.
So far, I've been able to short some of those steps, like, e.g:
i. Test the NodeJS logic of the action locally (giving manually values to the variables)
ii. Push the code to Repo Act
with the tag so the release is made automatically
iii. Use nektos/act to simulate the point 4. "Create an issue and trigger the action".
My results
But still, this requires to manually removing the mocked values, push the new version of Repo Act
, change the version on Repo Use
and re-testing by creating the Issue.
There is a way to speed up this process?
I'm way too new on GitHub Repository development and maybe I'm taking the long route.
It's not mandatory to generate a release version to use an action, you can use the branch name
directly.
For example: actions/checkout@main
instead of actions/checkout@v2.3.4
.
Therefore, targeting the main
branch instead of generating a new release each time will allow you to go faster in your tests.
You don't need to create a new repository to test the action, you can add a workflow in the own action to test it.
Therefore, there is no need to use two repos to do the testing, just use a workflow in the action that will always targeting the main
branch and trigger when your condition event is met.