~/codewithstu

Push Code To A Different Repo With Github Actions #shorts

Transcript

Hi, my name is Stu. In this quick video, I'm going to show you how to commit files to a different GitHub repository using GitHub Actions. First, we need to check out the source repository into a directory called src. Next, we do the same for the destination repository but into a folder called dest. When checking out, we need to persist the credentials and ensure that we use a token with write access, otherwise we won't be able to communicate with the destination repository. Next, we do our workflow before checking to see if there's any files to commit by using git status --porcelain and counting the number of lines returned. Finally, we commit our code as normal, ensuring that we set our username and our email, passing in a commit message, and then push as normal.

If you enjoyed this video, consider subscribing to the YouTube channel for more content like this.

// share_this