From the course: OpenAI API and MCP Development

Challenge: Leveraging GitHub actions with AI models

From the course: OpenAI API and MCP Development

Challenge: Leveraging GitHub actions with AI models

For the next challenge, the task for learners is to complete this workflow file. To add some jobs, starting line 33, and I recommend that you add one job which allows to interact with the language models to process some generative tasks. Whatever you'd like, for example, to explain a concept or to generate a report. Whatever you'd like. So there is this guide that I recommend on the GitHub blog that explains to you how you can automate your project with GitHub models in Actions. And here you can watch this video to understand how to use AI models in your GitHub Actions workflows. The first step is to add the right permissions to allow to read models. So this is the last one. So you need to put this line, which is already added to our workflow. That allows us to then interact with the language models. And next, you could define a job to, for example, detect or identify bugs or potential issues to then generate a report. Also, I'm going to take you to the quick start for GitHub models. So you can check this one out. Step three, you have one example to run models in GitHub Actions. And this one is very simple. We ask the language model to explain the concept of recursions. But what is important here is to understand how to define a request within your workflow with a GitHub Actions. And this one, we're going to call it callModel. So this is jobs. Then you have one job that you name callModel. Then you define the steps that you name firstCallAIModel. What we're going to do also is to export the environment variable. So this is important to authenticate first and then allow to interact with the language model. So this is the authentication step which is required. So you can be authorized to send an API request. Next, you define the API request with curl and provide the endpoints. You also provide with authorizations with the bearer and the GitHub tokens. And then you defined the request itself with the messages. And your question that you can read with content is explain the concept of recursion. And we also provide with the language model that we want to interact with, which is GPT-40. All right, so we're going to use a similar example. And here, this is where you're going to add your job. So we have one which is already defined here. This is the list of jobs. We only have one for now, which is used to install the dependencies. So that is one first step. And remember also, let's go back to our repository. So I am right now on my personal GitHub accounts, And we're gonna go check out the repositories. All right, so we go here. And we're gonna find here the actions. Okay, and you can see the last workflow that were run with one which failed, the first one which failed, and then the second one that succeeded. And so we have here this one single step. And remember that the last part was to actually read this message telling us that the Python dependencies installation is successful. All right. So this is up to you now to complete this workflow file. You can add messages to show that the process has completed successfully. All right. And we're going to see next a live example in video to see how we can complete this workflow to make it very interesting, but also very helpful using the power of the language models within the GitHub actions workflow.

Contents