-
Can an action get the path of the event that triggered the workflow to run? Assume the workflow is as follows
Would the
|
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 1 reply
-
I guess on push or pr events the action could find a file in the diff tree, and assume it’s the event path. Then it’s the workflow developers responsibility to restrict the event to only trigger on one path. Still it would be good if there was a |
Beta Was this translation helpful? Give feedback.
-
No that wouldn’t work (be reliable), because there could be multiple files in the one commit. The workflow would be triggered, but we still couldn’t be sure witch file corresponds to the event path. Perhaps get the workflow file that triggered the action. Then parse it for the event path. |
Beta Was this translation helpful? Give feedback.
-
In your custom JavaScript action, you can wrap the “Get a commit” API. If you want to list the files on a pull request, you can wrap the “List pull requests files” API in your action. |
Beta Was this translation helpful? Give feedback.
-
Yes but that does not help. The issue is in determining which of the changed files is the file that triggered the workflow (and the action) to run. |
Beta Was this translation helpful? Give feedback.
-
At first, you can list all the files contained in the specified commit. |
Beta Was this translation helpful? Give feedback.
-
Yes, but I’m talking about a published action. If it was just for me I’d know what the path/s where already. If github does not provide an |
Beta Was this translation helpful? Give feedback.
-
For a published action, the authors had designed that what the action can do or not. If you are not clear what things an action can do, you can view the README and the source codes of the action, or contact the authors to get more details information. If you want to expand the features of an action, you can fork the repository of the action to your account and re-develop the action as your demands. Again, if you want to view which files triggered the event, at first you need to list all the changed files contained in the commit, then compare with the patterns of the path filters. |
Beta Was this translation helpful? Give feedback.
-
I am the actions author. |
Beta Was this translation helpful? Give feedback.
-
You just need to improve the source code of the action to add the new features you require, then publish a new version of the action. |
Beta Was this translation helpful? Give feedback.
-
Ok thanks mate, I’ll take it from here. |
Beta Was this translation helpful? Give feedback.
-
Hi @mudlabs, did you figure out a way to get the paths from an action? |
Beta Was this translation helpful? Give feedback.
-
@gilbertbw YES
|
Beta Was this translation helpful? Give feedback.
@gilbertbw YES