From the course: OpenAI API and MCP Development

Combining GitHub Actions and AI models

From the course: OpenAI API and MCP Development

Combining GitHub Actions and AI models

Previously, we have seen different examples to test the built-in features and tools provided by the GitHub models to support prompt iteration, to compare and evaluate the language model's results, but also to easily integrate AI models, GitHub models, into your web projects. Next, we're going to see how to integrate it into our continuous integration workflow. So why we use CICD workflow? So the continuous integration and development workflow, this is to automate our projects with actions, GitHub actions. So whenever we push our code and projects into a remote repository. For example, you may want to run some tests to identify any issues and bugs before pushing to production, so before going to the next step, and then generate a report. So that's one example. And in the next example, we want to be able to actually connect AI and GitHub models into our workflow. We want to connect the GitHub actions with the GitHub models to integrate AI into our workflow. So let's see how to do that. So for the next project, you're going to need to have your own local repository. I'm going to show you this step very easily, so that's something that you should be able to do. But we're going to do that as a pre-phase. So before going to the next step, which is to create and define a workflow, we're going to create a local and remote repository. That's going to be the first and prerequisite step. And after that, we're going to see how to create a workflow file and define some jobs to configure our workflow. That includes calling AI models within this workflow. So that's going to be the advantage in the next example. So for the next example you should have one separate project because we're going to need to create a local repository to then create a remote repository. So for the next project you need to use your own GitHub accounts and credentials and your personal access token. As a reminder you're going to have instructions here as to how to do it. So to create a personal access token because you just need one authentication step to then be able to connect with the github models, use the tools, etc. Including setting up the workflow that we are about to do. All right, so I'm going to let you go through the instructions. So what I'm about to do first is to create a new local repository. Here we go. So this is initialized. Now let's go to github and remember that we need to use our personal github account. So I'm going to go here to create a new repository. Then we're going to follow all the steps. So I'm just going to call this one AI GitHub Actions, because I already have one with this name. I'm just going to start from scratch. And then we're going to select an owner. That's going to be my personal account. All right, so let's go through the different steps so we can go here and create the repository. That's it. Next, we follow the steps on the command line of our code editor. So we're going to go back to Visual Studio Code. So I don't need to add a readme because I already have one. So I'm going to need to do git add first, then commit, change the branch name to main if it's not main, and then add the origin and push the code. So let's do git add to add this project. And remember also to provide with the files that you want to ignore. So whenever you push this code. So that is for a JavaScript project. But if you work with a Python project, you want to ignore files like the virtual environment, VS Code as well. So I'm going to add it actually, VS Code, like this. What else? GitHub, we can keep it. And PyCache, OK. And also imports the .env file. So that includes your secrets variable. So you want to keep this one private and local, obviously. Let's save it and do git add. Next, we're going to add those lines to commit. Change the name of the branch if this is necessary and then add the origin and then push. Let's press Enter. Here we go. So this is done. Let's go back to GitHub. You're going to press refresh and now you're going to see that your project is available remotely. All right, so we are good for this step. So the next step will be to create a workflow file to define jobs and configure your continuous integration workflow.

Contents