How to Run Multiple Commands in One Github Actions Docker

What is the right way for running multiple commands in one action?

For example:

I want to run a python script as action. Before running this script I need to install the requirements.txt.

I can think of several options:

  • Create a Dockerfile with the command RUN pip install -r requirements.txt in it.
  • Use the python:3 image, and run the pip install -r requirements.txt in the entrypoint.sh file before running the arguments from args in main.workflow.
  • use both pip install and python myscript.py as args

Another example:

I want to run a script that exists in my repository, then compare 2 files (its output and a file that already exists).

This is a process that includes two commands, whereas in the first example, the pip install command can be considered a building command rather than a test command.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.