From the course: Build AI-Enhanced CI/CD Pipelines: Automate Code Reviews, PR Summaries & GitHub Issues with Copilot & Claude

Configure GitHub Actions automation

- [Instructor] Now we already have Claude Code installed on our local machine and connected with our VS Code. But we would want to leverage Claude Code even in our CI environment, which is when running on GitHub. So GitHub is deeply integrated with GitHub actions because it's the product or the service provided by the same company. But since Claude is a different company, we need to install their app on GitHub ecosystem so that we can leverage Claude Code even in GitHub environment. And in order to do that, what we need to do is to use one of the slash commands. So when I hit slash and type install, you will see an option called this install GitHub app. If you see this, just click enter and it asks, you want to install the GitHub app on the current repository or a different one. So we need the Claude Code app on the current repository. So with the current option selected, I will hit enter and it opens the page on GitHub, which says Claude app and a button that says install. So I'm going to click install and it says, where do you want to use that? And it says, which repositories all or select? So I'm going to select the one that I'm using. I'm going to search todo, and this is the repository that I have. So I'm only installing this app in the context of this repository, but not all. But if you want to use for all you, you would've selected all repositories and I will say install and authorize. And I need to use the passkey. So I will take this window a little bit down, I'm going to do the needful to pass in the passkey. And within minutes you will see that I already have this Claude Code installed. And if I close this window, come back to my VS Code. It's saying press enter once you have installed the app. So I'm going to hit enter. And it is asking what all things do you want to install for GitHub workflow? Do you want to install Claude Code? And this is by default selected. And what this means is if you install this, then in any of the GitHub issue or PR comment, we can mention @Claude and Claude will respond to it. So we don't necessarily need to use Claude on our machine or using VS Code. We can also use Claude in the context of GitHub now that our app is installed. And the second one is for the code reviews. So Claude Code can do the automated code reviews. With both of these selected I'm going to hit enter. And it's saying you need to install the GitHub app. So you need to either provide a new API key or create a long lived token with your cloud subscription. So I'm going to take this screen down and with create a long lived subscription, I'm going to hit enter. And it has taken me to this screen where it is asking for the authorization again, which is asking Claude Code would like to connect your Claude chat account and a similar screen. And I'm going to hit authorize button here. So as I hit authorize, I see this screen on my browser that says build something great. And on my VS Code the screen changes and it is now saying GitHub actions workflow created. API key saved to Claude Code auth token secret, which if I'm right, we should be able to find it. And it says your next step is creating a prefilled PR page. Install the GitHub app, which we have already, and merge the PR to enable the PR assistance. And I'm going to hit enter. And with that, I believe everything is all set because we are getting this information that GitHub action service complete. Now on GitHub, if I open my GitHub page, this is what I see. I see a branch that says add Claude GitHub actions file. And this is a GitHub action file because it is inside .GitHub workflows and which says, claudecodereview.yml. And it is asking me to open up the PR. So everything looks good here. And it says there is nothing to compare. Even if I'm trying to take this to my, oh, now I see the difference. So I will say create pull request. And this is installing the GitHub actions for Claude. I'm going to say create pull request. And as we see the files changed, we have claude.yml, which is ready to listen on issue comment, pull request, issues, and pull request review. And this is the claudecodereview.yml file, which will do the code review. So with that, let's go back to the conversations and everything is passed. So I'm going to merge pull request. Now, if I remember it mentioned that it created the long-lived token, which I believe we should be able to find in settings. And if I go to actions and go to or I go to secrets and variables and actions. Here is the Claude Code oauth token that was created when we were installing the GitHub app, Claude Code in GitHub environment. So with that, we are all set. The pull request has been merged. I can delete the branch, and now our main branch is all set. We don't have any pull request. Great. So what we have now is we have Claude as you can see here, as app available in this repo, which means I can interact with Claude even in GitHub environment. And this will be useful as we are going to automate our process for CI/CD workflow and even the development workflow. And that is going to come pretty soon in next few videos.

Contents