Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use composite actions for python scripts #22

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

mariajgrimaldi
Copy link
Collaborator

@mariajgrimaldi mariajgrimaldi commented Sep 26, 2024

Description

This PR is a continuation of a proposal I made here about making scripts more maintainable in the long term. I mentioned I had to figure out a good way of calling scripts within our workflow. Here's what I came up with:

Python scripts hosted in .github/workflows/actions

The additional functionalities with complex logic for the workflow should be implemented in a Python script hosted in a subdirectory within .github/workflows/actions with an explicit name containing its purpose. In this case, the script gets tutor configuration values, so the folder is called get-tutor-config, just like the Python script. Each script should be well-documented and modular, have a single responsibility, and be able to be executed locally for easier debugging.

Composite actions running Python scripts

  • Create a composite action that executes the script with the necessary configurations:
  • Call the composite action in the reusable workflow instead of the hardcoded script:

For this setup to work, we'd have to modify the workflow by:

I consider this approach to be more maintainable since we can now easily lint, test, and debug scripts. However, I understand it adds more layers of complexity, although easy to implement and use. The composite actions within .github/workflows/actions are meant to be small and straightforward since the only code added is a shell script executing a Python script. Therefore, the Python script should handle all complex logic to avoid returning to our previous situation.

This implementation is not set in stone, so feedback is very welcome.

@mariajgrimaldi mariajgrimaldi changed the title temp: try using composite action for scripts feat: use composite actions instead hard-coded scripts Sep 27, 2024
@mariajgrimaldi mariajgrimaldi changed the title feat: use composite actions instead hard-coded scripts feat: use composite actions for python scripts Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant