github-community-projects / github-community-projects/safe-settings

Visibility configuration files

Open
#210 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
921
Forks
226
Avg merge
18h 3m
Merged PRs (30d)
14

Description

## Prerequisites:

* Is the functionality available in the GitHub UI? If so, please provide a link to information about the feature.

Yes [here](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/setting-repository-visibility)

* Is the functionality available through the GitHub API? If the functionality is available, please provide links to the
API documentation (https://developer.github.com/v3/) as well as the Octokit documentation (https://octokit.github.io/).

API "visibility" [here](https://docs.github.com/en/enterprise-cloud@latest/rest/repos/repos)
Octokit "Get a repository" [here](https://octokit.github.io/rest.js/v18)

Code Example to get visibility for all repos and match to the visibility config
```
const repos = await octokit.rest.repos.listForOrg({
org: org
})

for (var i = 0; i < repos.data.length; i++)
{
const repoName = repos.data[i].name

const results = await octokit.rest.repos.get({
owner: org,
repo: repoName
});

switch (results.data.visibility) {
case 'private':
console.log(`Applying private.yml to ` + repoName);
break;
case 'public' :
console.log(`Applying public.yml to ` + repoName);
break;
case 'internal' :
console.log(`Applying internal.yml to ` + repoName);
break;
default:
console.log(`Error accessing visibility for ` + repoName);
}
}
```

## New Feature

Our organization requires different configurations for the different visibility options (public repos, private repos, internal repos).

For example:
We require a license file for all public repos, however this is not required for private or internal repos.

I did not see any documentation or code that alluded to this being a configuration option in the current state of Safe-Settings. Therefore, I am working on an enhancement in our forked version of Safe-Settings that would evaluate the various settings files in the following order:

settings.yml (org wide) -> (suborgs) -> visibility configurations (private.yml, public.yml, internal.yml) -> repos/(repo-name).yml

Would anyone else be interested in this feature? If so, please provide feedback, suggestions, etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.