Skip to content

Commit 45b6b18

Browse files
authored
feat: Update action and README (#4)
Signed-off-by: Roger Barker <[email protected]>
1 parent 6e40078 commit 45b6b18

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ To run the action within your github CI/CD pipeline you will need to create a
2121
fine-grained token with the following permissions:
2222

2323
### Organization Permissions
24-
- Read and Write access to organization administration
24+
2525
- Read, Write, and Admin access to organization custom properties
2626

27-
### Repository Permissions
28-
- Read access to metadata
29-
- Read and Write access to code and repository custom properties
27+
### Additional Information
28+
29+
- [Create or update a custom property for an organization](https://docs.github.com/en/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-organization)
30+
- [Fine-grained personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)
31+
- The owner of the fine-grained token must have full administrative rights to the organization.
3032

3133
---
3234

@@ -52,16 +54,16 @@ jobs:
5254
with:
5355
token: ${{ secrets.GH_ORG_ADMIN_TOKEN }}
5456
config-file: .github/custom_props.json
57+
organization: ${{ github.organization }}
5558
```
5659
5760
---
5861
5962
## Example custom_props.json
6063
61-
```json
62-
63-
// custom_props.json
64+
`custom_props.json`:
6465

66+
```json
6567
{
6668
"properties": [
6769
{
@@ -111,7 +113,9 @@ jobs:
111113
## 👤 Author
112114

113115
Roger Barker
116+
114117
[PandasWhoCode](https://pandaswhocode.com)
118+
115119
116120

117121
---

action.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,21 @@ inputs:
1414
description: 'Path to the config file'
1515
required: true
1616
default: 'custom_props.json'
17+
organization:
18+
description: 'Github Organization'
19+
required: true
1720

1821
runs:
1922
using: 'composite'
2023
steps:
2124
- name: Set Organization Custom Properties
2225
shell: bash
2326
env:
24-
GH_TOKEN: ${{ inputs.token }}
27+
GITHUB_AUTH_TOKEN: ${{ inputs.token }}
2528
CUSTOM_PROPS_FILE: ${{ inputs.config-file }}
29+
ORGANIZATION: ${{ inputs.organization }}
2630
run: |
27-
if [ -z "$GH_TOKEN" ]; then
31+
if [ -z "$GITHUB_AUTH_TOKEN" ]; then
2832
echo "Error: GH_TOKEN is not set."
2933
exit 1
3034
fi
@@ -33,5 +37,6 @@ runs:
3337
echo "Error: Custom properties file '${CUSTOM_PROPS_FILE}' does not exist."
3438
exit 1
3539
fi
36-
37-
gh api -X PATCH /orgs/${GITHUB_REPOSITORY_OWNER}/properties/schema --input ${CUSTOM_PROPS_FILE} --silent
40+
41+
export GH_TOKEN=${GITHUB_AUTH_TOKEN}
42+
gh api -X PATCH /orgs/${ORGANIZATION}/properties/schema --input ${CUSTOM_PROPS_FILE} --silent

0 commit comments

Comments
 (0)