From the course: OpenAI API and MCP Development

Writing the workflow file

From the course: OpenAI API and MCP Development

Writing the workflow file

Now, we want to see how to create a workflow file within our repository, and then define and set up jobs to configure the continuous integration workflow. And we will proceed with a very simple example. So the first step is to just show you how to set up GitHub Actions before we can actually connect the GitHub Actions to the GitHub models. So we can call AI models during jobs, during the workflow process. So let's go to Actions. you're going to see that for now, this is empty. And you're going to be invited to get started with any of these examples, all right? But what you can do is to actually do it locally. So we go back to our local projects to start with the GitHub Actions and GitHub Models. And let's go back to actually see how to proceed, because basically it's going to prompt you to create a new YAML file within a workflow directory within GitHub. So the same where we have defined and added a reusable prompt file. So this is the same location. So we're not going to be doing that remotely. I'm going to cancel the changes. I'm going to press OK, and then we go back to here. You're going to see that we already have this GitHub with a prompt file for now. All right, so let's go back. So let's go to the same location. So we want to create a new workflow directory, like this. And I'm going to name my YAML file Python install. So this is a very simple example for now, just to actually start with the process. After that, we're going to see how to add some other jobs. So I'm going to copy from the exercise files provided as part of this course, here you're going to find a workflow directory. So just find the corresponding exercise files for the corresponding chapter and video number. And we're going to copy this file, which is named Python install check. Let's copy. And we're going to go over this file. Let's go back to our local projects. I'm going to paste. Let's go through the different steps. So what we want to do, basically, is to first set up Python with a specific version. We can read it line 19. Next, we want to install all the dependencies. And once it is done, we're going to echo and read the message Python dependencies installed successfully. All right, so let's add this new workflow file with one job. And it's going to happen so whenever we push this code remotely. So I'm going to do git add. I'm going to commit and specify that I added a workflow file like this. And after this step, I'm going to be ready to push. So that's going to be exactly when we push that we're going to see the workflow beginning and starting on the remote GitHub repository. Let's go back. I'm going to show you that very quickly because it's going to happen very fast. We're going to go back to the remote. And after pushing, we're going to go to this tab. Let's go back to the local, git push, origin main. All right, so this is pushing. Let's go back very quickly and go to Actions. All right, so it's going to run. So we have one which is up and running. Let's go back here. We're going to see that this is here. We can actually see it here. For now, this is orange because this is going through. Let's go back again. Okay, so it looks like it failed. We're gonna see why. We're gonna go to Actions and see the details. So here you go back to Actions and see why it failed. So we can click here. All right, it looks like we've got an issue with OpenAI from line four, expected a semicolon. So we have a mistake in the file requirements.txt. So we're gonna fix this one and then commit again, and then push again. Let's go back and fix it. We're gonna go to requirements.txt. I have one trailing dot. Okay, so that's just one silly mistake. We're gonna fix it, then commit again. I'm gonna say that I fixed requirements.txt, and then push again. And after pushing, it's gonna start automatically a new workflow job. Let's go back. Okay, so you're gonna see it in action. All right, so you can actually see it, and you can see that this job is running corresponding to the last commit that we have just done. So now we can see that the workflow process is successful. You can actually see at this step that the Python dependencies were installed successfully. That's great. So now we've been able to run one job. That was just for testing. What we want to do next is to connect the GitHub actions with the GitHub models in order to be able to call AI models during the continuous integration workflow.

Contents