|
1 |
| -# update-custom-props |
2 |
| -Github Action to Update Custom Properties in a Workflow |
| 1 | +# README for the project Update Custom Properties |
| 2 | + |
| 3 | +**Update custom properties for all repos in an organization from a YAML file.** |
| 4 | + |
| 5 | +This action uses the GitHub CLI to read values from `repo-properties.yaml` and update repos in the organization. This |
| 6 | +can be useful for easily maintaining a single source of truth and a git-based history of updates to the |
| 7 | +custom properties of the organization. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## 🚀 Getting Started |
| 12 | + |
| 13 | +1. Add this GitHub Action to your workflow. |
| 14 | +2. Run the workflow. The file `repo-properties.yaml` will automatically be parsed and all appropriate repo values |
| 15 | +will be updated. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Fine Grained Token Requirements |
| 20 | + |
| 21 | +To run the action within your GitHub CI/CD pipeline you will need to create a |
| 22 | +fine-grained token with the following permissions: |
| 23 | + |
| 24 | +### Organization Permissions |
| 25 | + |
| 26 | +- Read and Write access to repository custom properties |
| 27 | + |
| 28 | +### Additional Information |
| 29 | + |
| 30 | +- [GitHub API for 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) |
| 31 | +- [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) |
| 32 | +- The owner of the fine-grained token must have full administrative rights to the organization. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## 📦 Inputs |
| 37 | + |
| 38 | +| Name | Description | Required | Default | |
| 39 | +|------------------------|-------------------------------------------------------------------------------------------------------|----------|------------------------| |
| 40 | +| `token` | GitHub Personal Access Token (Fine-Grained with: Repository custom properties `Read and Write` scope) | ✅ Yes | — | |
| 41 | +| `repo-properties.yaml` | File should be located in the root-level directory. | ✅ Yes | `repo-properties.yaml` | |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## 🛠 Usage |
| 46 | + |
| 47 | +```yaml |
| 48 | +jobs: |
| 49 | + update-schema: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - uses: PandasWhoCode/update-custom-properties@v1 |
| 55 | + with: |
| 56 | + token: ${{ secrets.GH_CUSTOM_PROPERTIES_TOKEN }} |
| 57 | +``` |
| 58 | +
|
| 59 | +--- |
| 60 | +
|
| 61 | +## Example custom_props.json |
| 62 | +
|
| 63 | +`custom_props.json`: |
| 64 | +```yaml |
| 65 | +org: PandasWhoCode |
| 66 | +repositories: |
| 67 | + - name: my-example-repo |
| 68 | + last-date-modified: "" |
| 69 | + initial-ci-review-by-team: "pandas" |
| 70 | + initial-ci-review-date: "2025-04-07" |
| 71 | + initial-security-review-by-team: "admins" |
| 72 | + initial-security-review-date: "2025-04-15" |
| 73 | + last-security-review-by-team: "reviewers" |
| 74 | + last-security-review-date: "2025-05-01" |
| 75 | +``` |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## 👤 Author |
| 80 | + |
| 81 | +Andrew Brandt |
| 82 | + |
| 83 | +[PandasWhoCode](https://pandaswhocode.com) |
| 84 | + |
| 85 | +[andrew.brandt@pandaswhocode.com](mailto:andrew.brandt@pandaswhocode.com) |
| 86 | + |
| 87 | +--- |
0 commit comments