Skip to content

Commit 6e40078

Browse files
committed
Add action and README
Signed-off-by: Roger Barker <[email protected]>
1 parent 4ccc5ac commit 6e40078

File tree

3 files changed

+340
-0
lines changed

3 files changed

+340
-0
lines changed

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# README for the project Configure Custom Properties
2+
3+
**Set and manage GitHub Organization-level Custom Properties via a simple custom_props.json config file.**
4+
5+
This action uses the GitHub CLI to apply property schemas automatically, making it easier to standardize
6+
metadata across your repositories.
7+
8+
---
9+
10+
## 🚀 Getting Started
11+
12+
1. Create a custom_props.json file in the root of your repository (or another path).
13+
2. Add this GitHub Action to your workflow.
14+
3. Run the pipeline to apply the schema at the organization level.
15+
16+
---
17+
18+
## Fine Grained Token Requirements
19+
20+
To run the action within your github CI/CD pipeline you will need to create a
21+
fine-grained token with the following permissions:
22+
23+
### Organization Permissions
24+
- Read and Write access to organization administration
25+
- Read, Write, and Admin access to organization custom properties
26+
27+
### Repository Permissions
28+
- Read access to metadata
29+
- Read and Write access to code and repository custom properties
30+
31+
---
32+
33+
## 📦 Inputs
34+
35+
| Name | Description | Required | Default |
36+
|--------------|--------------------------------------------|----------|----------------------|
37+
| `token` | GitHub Personal Access Token (Fine-Grained with `Admin: write` org scope) | ✅ Yes ||
38+
| `config-file`| Path to the custom properties config JSON | ✅ Yes | `custom_props.json` |
39+
40+
---
41+
42+
## 🛠 Usage
43+
44+
```yaml
45+
jobs:
46+
update-schema:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: pandaswhocode/configure-custom-properties@v1
52+
with:
53+
token: ${{ secrets.GH_ORG_ADMIN_TOKEN }}
54+
config-file: .github/custom_props.json
55+
```
56+
57+
---
58+
59+
## Example custom_props.json
60+
61+
```json
62+
63+
// custom_props.json
64+
65+
{
66+
"properties": [
67+
{
68+
"property_name": "single_select_property",
69+
"value_type": "single_select",
70+
"allowed_values": [
71+
"option-1",
72+
"option-2",
73+
"option-3",
74+
"option-4"
75+
],
76+
"description": "Default single select property",
77+
"values_editable_by": "org_and_repo_actors",
78+
"required": false
79+
},
80+
{
81+
"property_name": "multi_select_property",
82+
"value_type": "multi_select",
83+
"allowed_values": [
84+
"option-1",
85+
"option-2",
86+
"option-3",
87+
"option-4"
88+
],
89+
"description": "Default multi select property",
90+
"values_editable_by": "org_and_repo_actors",
91+
"required": false
92+
},
93+
{
94+
"property_name": "text_property",
95+
"value_type": "string",
96+
"description": "Default 'text' property type",
97+
"values_editable_by": "org_and_repo_actors",
98+
"required": false
99+
},
100+
{
101+
"property_name": "bool_test",
102+
"value_type": "true_false",
103+
"description": "Default true-false property type",
104+
"values_editable_by": "org_and_repo_actors",
105+
"required": false
106+
}
107+
]
108+
}
109+
```
110+
111+
## 👤 Author
112+
113+
Roger Barker
114+
[PandasWhoCode](https://pandaswhocode.com)
115+
116+
117+
---

action.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Set Custom Properties Schema Action'
2+
description: 'This action sets up the custom properties for the Github Organization.'
3+
author: 'Roger Barker <[email protected]>'
4+
organization: 'PandasWhoCode'
5+
branding:
6+
icon: 'arrow-up-circle'
7+
color: 'purple'
8+
9+
inputs:
10+
token:
11+
description: 'Github Personal AccessToken'
12+
required: true
13+
config-file:
14+
description: 'Path to the config file'
15+
required: true
16+
default: 'custom_props.json'
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: Set Organization Custom Properties
22+
shell: bash
23+
env:
24+
GH_TOKEN: ${{ inputs.token }}
25+
CUSTOM_PROPS_FILE: ${{ inputs.config-file }}
26+
run: |
27+
if [ -z "$GH_TOKEN" ]; then
28+
echo "Error: GH_TOKEN is not set."
29+
exit 1
30+
fi
31+
32+
if [ ! -f "$CUSTOM_PROPS_FILE" ]; then
33+
echo "Error: Custom properties file '${CUSTOM_PROPS_FILE}' does not exist."
34+
exit 1
35+
fi
36+
37+
gh api -X PATCH /orgs/${GITHUB_REPOSITORY_OWNER}/properties/schema --input ${CUSTOM_PROPS_FILE} --silent

custom_props.json

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
{
2+
"properties": [
3+
{
4+
"property_name": "initial-ci-review-by-team",
5+
"value_type": "single_select",
6+
"allowed_values": [
7+
"platform-ci",
8+
"release-engineering",
9+
"security",
10+
"devops"
11+
],
12+
"description": "Team which performed initial CI review",
13+
"values_editable_by": "org_and_repo_actors",
14+
"required": false
15+
},
16+
{
17+
"property_name": "initial-config-review-by-team",
18+
19+
"value_type": "single_select",
20+
"allowed_values": [
21+
"platform-ci",
22+
"release-engineering",
23+
"security",
24+
"devops"
25+
],
26+
"description": "Team which performed initial config review",
27+
"values_editable_by": "org_and_repo_actors",
28+
"required": false
29+
},
30+
{
31+
"property_name": "initial-oss-review-by-team",
32+
33+
"value_type": "single_select",
34+
"allowed_values": [
35+
"platform-ci",
36+
"release-engineering",
37+
"security",
38+
"devops"
39+
],
40+
"description": "Team which performed initial OSS review",
41+
"values_editable_by": "org_and_repo_actors",
42+
"required": false
43+
},
44+
{
45+
"property_name": "initial-security-review-by-team",
46+
47+
"value_type": "single_select",
48+
"allowed_values": [
49+
"platform-ci",
50+
"release-engineering",
51+
"security",
52+
"devops"
53+
],
54+
"description": "Team which performed initial security review",
55+
"values_editable_by": "org_and_repo_actors",
56+
"required": false
57+
},
58+
{
59+
"property_name": "last-ci-review-by-team",
60+
61+
"value_type": "single_select",
62+
"allowed_values": [
63+
"platform-ci",
64+
"release-engineering",
65+
"security",
66+
"devops"
67+
],
68+
"description": "Team which performed latest CI review",
69+
"values_editable_by": "org_and_repo_actors",
70+
"required": false
71+
},
72+
{
73+
"property_name": "last-config-review-by-team",
74+
75+
"value_type": "single_select",
76+
"allowed_values": [
77+
"platform-ci",
78+
"release-engineering",
79+
"security",
80+
"devops"
81+
],
82+
"description": "Team which performed latest config review",
83+
"values_editable_by": "org_and_repo_actors",
84+
"required": false
85+
},
86+
{
87+
"property_name": "last-oss-review-by-team",
88+
89+
"value_type": "single_select",
90+
"allowed_values": [
91+
"platform-ci",
92+
"release-engineering",
93+
"security",
94+
"devops"
95+
],
96+
"description": "Team which performed latest OSS review",
97+
"values_editable_by": "org_and_repo_actors",
98+
"required": false
99+
},
100+
{
101+
"property_name": "last-security-review-by-team",
102+
103+
"value_type": "single_select",
104+
"allowed_values": [
105+
"platform-ci",
106+
"release-engineering",
107+
"security",
108+
"devops"
109+
],
110+
"description": "Team which performed latest security review",
111+
"values_editable_by": "org_and_repo_actors",
112+
"required": false
113+
},
114+
{
115+
"property_name": "last-date-modified",
116+
117+
"value_type": "string",
118+
"description": "Date of last modification",
119+
"values_editable_by": "org_and_repo_actors",
120+
"required": false
121+
},
122+
{
123+
"property_name": "initial-ci-review-date",
124+
125+
"value_type": "string",
126+
"description": "Date of initial CI review",
127+
"values_editable_by": "org_and_repo_actors",
128+
"required": false
129+
},
130+
{
131+
"property_name": "initial-config-review-date",
132+
133+
"value_type": "string",
134+
"description": "Date of initial configuration review",
135+
"values_editable_by": "org_and_repo_actors",
136+
"required": false
137+
},
138+
{
139+
"property_name": "initial-oss-review-date",
140+
141+
"value_type": "string",
142+
"description": "Date of initial OSS review",
143+
"values_editable_by": "org_and_repo_actors",
144+
"required": false
145+
},
146+
{
147+
"property_name": "initial-security-review-date",
148+
149+
"value_type": "string",
150+
"description": "Date of initial security review",
151+
"values_editable_by": "org_and_repo_actors",
152+
"required": false
153+
},
154+
{
155+
"property_name": "last-ci-review-date",
156+
157+
"value_type": "string",
158+
"description": "Date of latest CI review",
159+
"values_editable_by": "org_and_repo_actors",
160+
"required": false
161+
},
162+
{
163+
"property_name": "last-config-review-date",
164+
165+
"value_type": "string",
166+
"description": "Date of latest configuration review",
167+
"values_editable_by": "org_and_repo_actors",
168+
"required": false
169+
},
170+
{
171+
"property_name": "last-oss-review-date",
172+
173+
"value_type": "string",
174+
"description": "Date of latest OSS review",
175+
"values_editable_by": "org_and_repo_actors",
176+
"required": false
177+
},
178+
{
179+
"property_name": "last-security-review-date",
180+
"value_type": "string",
181+
"description": "Date of latest security review",
182+
"values_editable_by": "org_and_repo_actors",
183+
"required": false
184+
}
185+
]
186+
}

0 commit comments

Comments
 (0)