it's octoLIT
Tags: javascript, github, opensource
Published: 2021-10-27 15:01:04

One of my recent PRs on [Open Sauced](https://github.com/open-sauced/open-sauced) was a chance to learn about two things - GitHub Actions, and managing multiple repos (more specifically a project growing into multiple repos).

As I described briefly in [backseat coding](https://dev.to/mtfoley/backseat-coding-3ikb) the Open Sauced project leverages the user's `open-sauced-goals` repo as a data store. 
> Each issue in it represents a GitHub repo that I intend to contribute to, so mine looks like this at the moment.
![goals](https://res.cloudinary.com/practicaldev/image/fetch/s--bW0DUs1O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k0wh42dz9dufipr097dt.png)
The data fields map like this:
- Issue title => repo full_name
- Issue description => my notes about it

So what happens if a repo changes names or the owner of the repo changes names? For the changes I was describing in my post [removing lodash](https://dev.to/mtfoley/removing-lodash-37on), the intent was to match the issues list with the `data.json` file contents by comparing the issue title with the `full_name` property in the `data.json` file.  

The `data.json` file is populated by a GitHub Actions workflow within the user's `open-sauced-goals` repo, and because of the way it's populated using [octokit](https://octokit.github.io/rest.js/v18/), it will reflect the `full_name` of repo as currently named. As some of you may know, when a [repo changes names](https://docs.github.com/en/repositories/creating-and-managing-repositories/renaming-a-repository) or the [owner changes names](https://docs.github.com/en/organizations/managing-organization-settings/renaming-an-organization), GitHub will still redirect web traffic pointed to the repo's old URL, and this includes REST API traffic as well.

What wasn't being changed was the issue title in the `open-sauced-goals` repo, so there was an edge case where the issues couldn't be matched up with the supplemental data in `data.json`.

Fixing this is where my PR came into play: https://github.com/open-sauced/actions/pull/15
I'm happy to say that working with Octokit was very easy and made patching this GitHub action a breeze. The key additions were here:
```js
if(data.full_name.trim() !== issue.title){
 
  goalsToRename.push({
    title:data.full_name,
    number:issue.number
  })
}
```
and then here:
```js
async function renameGoals(){
  return Promise.all(
    goalsToRename.map(async goal => {
      return await octokit.rest.issues.update({
        owner:login,
        repo:"open-sauced-goals",
        issue_number:goal.number,
        title:goal.title
      })
    })
  );
}
```

The last thing that I learned about with this PR was some of the effects of "sprawl" of a project.  In keeping with best practices, I created an [issue](https://github.com/open-sauced/actions/issues/14) first before creating the PR and by the time I was finished with the PR, I noticed there was [already an issue](https://github.com/open-sauced/goals-template/issues/8) in `goals-template` repo.  This makes plenty of sense when you think about the ways that the Open Sauced project has grown. 

The Open Sauced project has been gaining more repos over the last few months as things are abstracted into their own domains. We've added a separate repo for a customized GraphiQL implementation, the documentation was split out into its own repo, and most of the GitHub actions have been split out into their own repo (which was where this PR went). 

I hope you've enjoyed reading about some of these experiences and I'd love feedback on these if you have a moment! 
![that's lit](https://media.giphy.com/media/jba8ucWVAhG9VcUkx9/giphy.gif)