Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
dfb196d
feat(yaml): add yaml as valid file format
dabcoder Nov 26, 2024
77bd720
fix(syntax)
dabcoder Nov 26, 2024
01278bc
Merge remote-tracking branch 'forked/main-enterprise' into db/-/yaml-…
dabcoder Dec 19, 2024
0d2f75a
ci(deps): bump azure/aks-set-context from 3 to 4 (#613)
dependabot[bot] Dec 19, 2024
f92d23c
ci(deps): bump azure/k8s-create-secret from 4 to 5 (#614)
dependabot[bot] Dec 19, 2024
e7043c2
ci(deps): bump azure/login from 1 to 2 (#615)
dependabot[bot] Dec 19, 2024
b21ad69
Testing and merging pr 622 (#714)
decyjphr Dec 19, 2024
506613f
Add glob matching to include/exclude in diffable (#622)
avelizmu Dec 19, 2024
a21c657
ci(deps): bump Azure/k8s-deploy from 4.10 to 5 (#625)
dependabot[bot] Dec 19, 2024
6481071
test(settings): add tests to verify both yaml and yml extensions work
dabcoder Dec 20, 2024
635d9f8
fix(function): test new function
dabcoder Dec 20, 2024
d80a135
fix(overrideRepoConfig): remove helper function use
dabcoder Dec 20, 2024
a97ed17
test(settings): attempt to fix failing tests
dabcoder Dec 20, 2024
0590f68
test(settings): simplify
dabcoder Dec 20, 2024
b3b8cb5
Bump @travi/any from 2.1.10 to 3.1.2 (#639)
dependabot[bot] Dec 21, 2024
c8941da
Bump @eslint/eslintrc from 2.1.4 to 3.1.0 (#640)
dependabot[bot] Dec 21, 2024
20a4508
Bump eslint-plugin-promise from 6.1.1 to 6.6.0 (#661)
dependabot[bot] Dec 21, 2024
a692dbf
Same repository that is part of multiple suborgs (#664)
decyjphr Dec 21, 2024
c2d4db9
Fix code scanning alert #2: Prototype-polluting function (#686)
decyjphr Dec 22, 2024
c1ee48c
Pull and test pr 689 (#718)
decyjphr Dec 25, 2024
c1bc922
Pin non-immutable Actions to latest SHA and remediate dependency vuln…
lindluni Dec 26, 2024
87beedc
Decyjphr/pr 683 (#721)
decyjphr Dec 28, 2024
5375c98
Bump probot from 12.3.4 to 13.3.8 (#696)
dependabot[bot] Dec 30, 2024
2ce0136
CONFIG_REPO does not exists, change to correct ADMIN_REPO (#716)
karl-petter Jan 2, 2025
ee5909a
fix: create new repositories during full-sync operation (#710)
PendaGTP Jan 2, 2025
33458eb
fix(settings): load repo configuration in tests
dabcoder Jan 6, 2025
40a75a6
docs(readme): yaml extension can be used too
dabcoder Jan 7, 2025
063800c
Fix existing existing environment variable filter (#717)
klutchell Jan 8, 2025
4c553a9
Bump nock from 13.5.4 to 13.5.6 (#724)
dependabot[bot] Jan 8, 2025
ff027d2
Bump eslint-plugin-import from 2.29.1 to 2.31.0 (#725)
dependabot[bot] Jan 8, 2025
5a4b346
Bump standard from 17.1.0 to 17.1.2 (#726)
dependabot[bot] Jan 8, 2025
1fff61c
Bump eta from 3.4.0 to 3.5.0 (#727)
dependabot[bot] Jan 8, 2025
72dc612
fix(conflicts)
dabcoder Jan 9, 2025
3b7eb05
fix: made envs application actually NOP (#691)
randomcascade Jan 19, 2025
774b2e5
feat: add unarchiving plugin (#692)
randomcascade Jan 20, 2025
c8639b6
revert probot to 2.3.3 (#745)
decyjphr Jan 22, 2025
a8a27e7
Update NOTICE.md (#749)
decyjphr Jan 23, 2025
b8a153a
Allow branch protection settings to be overridden outside of safe set…
jitran Dec 20, 2024
d6946cc
Allow ruleset settings to be overridden outside of safe settings.
jitran Jan 7, 2025
99127f7
Created Overrides module for handling externally defined settings.
jitran Jan 7, 2025
00e9205
On top level ruleset updates, it would trigger a sync all that will t…
jitran Jan 8, 2025
3c6790f
Updated readme.
jitran Jan 10, 2025
ac36f25
Added unit tests.
jitran Jan 15, 2025
b893e4a
Added unit tests for organisation rulesets.
jitran Jan 15, 2025
4731148
Updated tests to reflect latest ruleset data type changes.
jitran Jan 16, 2025
c8926b8
Updated documentation.
jitran Jan 16, 2025
0c5b35c
Updated ruleset overrides based on the latest api change.
jitran Jan 21, 2025
fa8d2d7
Updated documentation and added example scenarios.
jitran Jan 25, 2025
a427c01
Merge pull request #741 from jitran/jitran/custom-pr-status-checks
igorcosta Jan 25, 2025
5c9bd64
Bump lockfile-lint from 4.13.2 to 4.14.0 (#755)
dependabot[bot] Mar 3, 2025
d942c0c
ci(deps): bump docker/setup-buildx-action from 3.8.0 to 3.10.0 (#769)
dependabot[bot] Mar 3, 2025
142013e
ci(deps): bump docker/build-push-action from 6.10.0 to 6.15.0 (#770)
dependabot[bot] Mar 3, 2025
57d0b85
ci(deps): bump docker/metadata-action from 5.6.1 to 5.7.0 (#771)
dependabot[bot] Mar 3, 2025
91add23
ci(deps): bump docker/setup-qemu-action from 3.2.0 to 3.6.0 (#772)
dependabot[bot] Mar 3, 2025
1c653ec
Bump @probot/adapter-aws-lambda-serverless from 3.0.4 to 4.0.3 (#773)
dependabot[bot] Mar 3, 2025
7b0c9ec
Bump nock from 13.5.6 to 14.0.1 (#776)
dependabot[bot] Mar 3, 2025
5036778
Bump smee-client from 1.2.5 to 3.1.1 (#777)
dependabot[bot] Mar 3, 2025
9dbe6c7
Bump the npm_and_yarn group across 1 directory with 3 updates (#779)
dependabot[bot] Mar 3, 2025
5469c90
Add tests to update and delete environment vars (#766)
klutchell Mar 12, 2025
cbff6be
fix: handle empty deployment config yaml file (#731)
PendaGTP Mar 15, 2025
23b2a85
Merge branch 'main-enterprise' into db/-/yaml-extension
decyjphr Mar 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
"standard"
],
"parserOptions": {
"ecmaVersion": 12
"ecmaVersion": 13
},
"rules": {
},
"ignorePatterns": ["test/**/*.js"]
"overrides": [
{
"files": ["test/**/*.js"],
"env": {
"jest": true
}
}
]
}
19 changes: 0 additions & 19 deletions .github/actions/codeql-analysis/action.yml

This file was deleted.

14 changes: 9 additions & 5 deletions .github/workflows/create-pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: write
packages: write

jobs:
build:
if: ${{ github.actor != 'dependabot'}}
Expand All @@ -46,15 +50,15 @@ jobs:
cache: 'npm'
- run: npm install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
- name: Log in to the Container registry
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image Locally
uses: docker/build-push-action@master
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
with:
context: .
file: ./Dockerfile
Expand All @@ -73,15 +77,15 @@ jobs:
- run: echo "${{ github.ref }}"
- name: Tag a final release
id: prerelease
uses: actionsdesk/semver@0.6.0-rc.10
uses: actionsdesk/semver@82aa4310e4e21c59cd0020007a4278e733e81dcb
with:
bump: ${{ inputs.bump }}
prerelease: ${{ inputs.prerelease }}
prelabel: ${{ inputs.prelabel }}
commitish: ${{ github.ref }}
- name: Push Docker Image
if: ${{ success() }}
uses: docker/build-push-action@master
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
with:
context: .
file: ./Dockerfile
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: write
packages: write

jobs:
build:
if: ${{ github.actor != 'dependabot'}}
Expand All @@ -24,15 +28,15 @@ jobs:
cache: "npm"
- run: npm install
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
- name: Log in to the Container registry
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image Locally
uses: docker/build-push-action@master
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
with:
context: .
file: ./Dockerfile
Expand All @@ -50,12 +54,12 @@ jobs:
curl http://localhost:3000
- name: Tag a final release
id: finalrelease
uses: actionsdesk/semver@0.6.0-rc.10
uses: actionsdesk/semver@82aa4310e4e21c59cd0020007a4278e733e81dcb
with:
bump: final
- name: Push Docker Image
if: ${{ success() }}
uses: docker/build-push-action@master
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
with:
context: .
file: ./Dockerfile
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,35 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: azure/login@v1
- uses: azure/login@a65d910e8af852a8061c627c456678983e180302
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: azure/aks-set-context@v3
- uses: azure/aks-set-context@feeca6405be94202afcb1c395616ff29b1811b9f
with:
resource-group: ${{env.AZURE_RESOURCE_GROUP}}
cluster-name: ${{env.AZURE_AKS_CLUSTER}}
id: login
- run: |
kubectl get deployment
- name: app-env
uses: azure/k8s-create-secret@v4
uses: azure/k8s-create-secret@6e0ba8047235646753f2a3a3b359b4d0006ff218
with:
namespace: 'default'
secret-type: 'generic'
arguments: --from-literal=APP_ID=${{ secrets.APP_ID }} --from-literal=PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} --from-literal=WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }}
secret-name: app-env
- name: Set imagePullSecret
uses: azure/k8s-create-secret@v4
uses: azure/k8s-create-secret@6e0ba8047235646753f2a3a3b359b4d0006ff218
with:
namespace: ${{env.AZURE_AKS_NAMESPACE}}
container-registry-url: ${{env.IMAGE_REGISTRY_URL}}
container-registry-username: ${{ secrets.DOCKER_USERNAME }}
container-registry-password: ${{ secrets.DOCKER_PASSWORD }}
secret-name: 'image-pull-secret'
id: create-secret
- uses: Azure/k8s-deploy@v4.10
- uses: Azure/k8s-deploy@v5
with:
namespace: ${{env.AZURE_AKS_NAMESPACE}}
manifests: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Node.js CI
on:
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/rc-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Tag a rc release
if: ${{ !github.event.pull_request.head.repo.fork }}
id: rcrelease
uses: actionsdesk/semver@0.6.0-rc.10
uses: actionsdesk/semver@82aa4310e4e21c59cd0020007a4278e733e81dcb
with:
prerelease: withBuildNumber
prelabel: rc
Expand All @@ -60,23 +60,23 @@ jobs:
- run: echo ${{ github.actor }}

- name: Log in to the Container registry
uses: docker/login-action@v3
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
- name: Build and push Docker image
uses: docker/build-push-action@master
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
with:
context: .
push: true
Expand Down
1 change: 1 addition & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- type-fest, 0.3.1,(MIT OR CC0-1.0),
- type-fest, 0.6.0,(MIT OR CC0-1.0),
- type-fest, 0.8.1,(MIT OR CC0-1.0),
- @apidevtools/json-schema-ref-parser, MIT
- @babel/code-frame, 7.12.13, MIT,
- @babel/code-frame, 7.5.5, MIT,
- @babel/compat-data, 7.13.11, MIT,
Expand Down
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
> [!NOTE]
> The `suborg` and `repo` level settings directory structure cannot be customized.
>
> Settings files must have a `.yml` extension only. For now, the `.yaml` extension is ignored.


## How it works
Expand Down Expand Up @@ -123,6 +122,46 @@ overridevalidators:

A sample of `deployment-settings` file is found [here](docs/sample-settings/sample-deployment-settings.yml).

### Custom Status Checks
For branch protection rules and rulesets, you can allow for status checks to be defined outside of safe-settings together with your usual safe settings.

This can be defined at the org, sub-org, and repo level.

To configure this for branch protection rules, specify `{{EXTERNALLY_DEFINED}}` under the `contexts` keyword:
```yaml
branches:
- name: main
protection:
...
required_status_checks:
contexts:
- "{{EXTERNALLY_DEFINED}}"
```

For rulesets, specify `{{EXTERNALLY_DEFINED}}` under the `required_status_checks` keyword:
```yaml
rulesets:
- name: Status Checks
...
rules:
- type: required_status_checks
parameters:
required_status_checks:
- context: "{{EXTERNALLY_DEFINED}}"
```

Notes:
- For the same branch that is covered by multi-level branch protection rules, contexts defined at the org level are merged into the sub-org and repo level contexts, while contexts defined at the sub-org level are merged into the repo level contexts.
- Rules from the sub-org level are merged into the repo level when their ruleset share the same name. Becareful not to define the same rule type in both levels as it will be rejected by GitHub.
- When `{{EXTERNALLY_DEFINED}}` is defined for a new branch protection rule or ruleset configuration, they will be deployed with no status checks.
- When an existing branch protection rule or ruleset configuration is amended with `{{EXTERNALLY_DEFINED}}`, the status checks in the existing rules in GitHub will remain as is.

> ⚠️ **Warning:**
When `{{EXTERNALLY_DEFINED}}` is removed from an existing branch protection rule or ruleset configuration, the status checks in the existing rules in GitHub will revert to the checks that are defined in safe-settings. From this point onwards, all status checks configured through the GitHub UI will be reverted back to the safe-settings configuration.

#### Status checks inheritance across scopes
Refer to [Status checks](docs/status-checks.md).

### Performance
When there are 1000s of repos to be managed -- and there is a global settings change -- safe-settings will have to work efficiently and only make the necessary API calls.

Expand Down Expand Up @@ -290,7 +329,21 @@ The following can be configured:
- `Rulesets`
- `Environments` - wait timer, required reviewers, prevent self review, protected branches deployment branch policy, custom deployment branch policy, variables, deployment protection rules

It is possible to provide an `include` or `exclude` settings to restrict the `collaborators`, `teams`, `labels` to a list of repos or exclude a set of repos for a collaborator.
> [!important]
> It is possible to provide an `include` or `exclude` settings to restrict the `collaborators`, `teams`, `labels` to a list of repos or exclude a set of repos for a collaborator.
> The include/exclude pattern can also be for glob. For e.g.:
```
teams:
- name: Myteam-admins
permission: admin
- name: Myteam-developers
permission: push
- name: Other-team
permission: push
include:
- '*-config'
```
> Will only add `Other-team` to only `*-config` repos

See [`docs/sample-settings/settings.yml`](docs/sample-settings/settings.yml) for a sample settings file.

Expand Down Expand Up @@ -368,7 +421,7 @@ You can pass environment variables; the easiest way to do it is via a `.env` fil

## How to use

1. Create an `admin` repo (or an alternative of your choosing) within your organization. Remember to set `CONFIG_REPO` if you choose something other than `admin`. See [Environment variables](#environment-variables) for more details.
1. Create an `admin` repo (or an alternative of your choosing) within your organization. Remember to set `ADMIN_REPO` if you choose something other than `admin`. See [Environment variables](#environment-variables) for more details.

2. Add the settings for the `org`, `suborgs`, and `repos`. Sample files can be found [here](docs/sample-settings).

Expand Down
3 changes: 2 additions & 1 deletion docs/github-settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
| Configure branch protection rules | [Branch Protection](5.%20branch-protection.md) |
| Configure deployment environments | [Deployment Environments](6.%20deployment-environments.md) |
| Configure auto-link references | [AutoLinks](7.%20autolinks.md) |
| Configure pre-defined labels for issues and pull requests | [Labels](8.%20labels.md) |
| Configure pre-defined labels for issues and pull requests | [Labels](8.%20labels.md) |

Loading