Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theztefan/rulesets-as-code-action
https://github.com/theztefan/rulesets-as-code-action
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/theztefan/rulesets-as-code-action
- Owner: theztefan
- License: mit
- Created: 2024-08-09T08:29:20.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T08:05:34.000Z (5 months ago)
- Last Synced: 2024-08-13T09:13:27.441Z (5 months ago)
- Language: TypeScript
- Size: 1.41 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Rulesets-as-Code Action
This is a GitHub Actions that allows you to manage your GitHub Rulesets via
code. It is a simple action that enables you to establish a workflow where a
ruleset definition is stored in a `json` file and any change to it needs to be
validated and approved by CODEOWNERS before it gets deployed as a change to the
Organization.To update the organization the Action will use the available REST APIs:
- [Get an organization repository ruleset](https://docs.github.com/en/rest/orgs/rules?apiVersion=2022-11-28#get-an-organization-repository-ruleset)
- [Update an organization repository rules](https://docs.github.com/en/rest/orgs/rules?apiVersion=2022-11-28#update-an-organization-repository-ruleset)## Inputs
- `ruleset-file-path`: Path to the local ruleset file.
- `token`: GitHub token for authentication.
- `organization`: GitHub organization name (optional).## Usage
The idea is to run this action in a central Rulset governing reporsitory for
your organization. It can either be an existing repository where you manage
other policies or a dedicated new repository that you created for this purpose.```yaml
name: Manage Organization Rulesets
on:
push:
branches: [main]
paths: [ruleset.json]
jobs:
ruleset-check:
runs-on: ubuntu-latest
permissions: read-all
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_KEY }}- name: Rulesets as Code
id: rulesets-as-code
uses: theztefan/rulesets-as-code-action@main
with:
ruleset-file-path: 'ruleset.json'
token: ${{ steps.app-token.outputs.token }}
organization: 'your-organization'
```