|
1 | | -# read-all-custom-properties |
| 1 | +# README for the project Read All Custom Properties |
2 | 2 |
|
3 | | -Github Action to read all custom properties from all repos in an organization. |
| 3 | +**Read all custom properties and values from all repos in the organization and write to a file.** |
| 4 | + |
| 5 | +This action uses the GitHub CLI to read all properties from all repos in the organization. It can write |
| 6 | +the results to a `repo-properties.yaml` file as well, for use with input to |
| 7 | +[update custom properties](https://github.com/PandasWhoCode/update-custom-properties) action. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## 🚀 Getting Started |
| 12 | + |
| 13 | +1. Add this GitHub Action to your workflow. |
| 14 | +2. Run the workflow. A new commit will be generated on the branch you run it from containing the `repo-properties.yaml` |
| 15 | +file. |
| 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 access to organization custom properties |
| 27 | + |
| 28 | +### Repository Permissions |
| 29 | + |
| 30 | +- Read access to Repository Metadata |
| 31 | +- Read and Write access to Repository contents |
| 32 | + |
| 33 | +### Additional Information |
| 34 | + |
| 35 | +- [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) |
| 36 | +- [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) |
| 37 | +- The owner of the fine-grained token must have full administrative rights to the organization. |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## 📦 Inputs |
| 42 | + |
| 43 | +| Name | Description | Required | Default | |
| 44 | +|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|----------|---------| |
| 45 | +| `token` | GitHub Personal Access Token (Fine-Grained with: Organization custom properties `Read`, Repository contents `Read and Write` scope) | ✅ Yes | — | |
| 46 | +| `overwrite-existing-file` | Boolean for choosing to overwrite `repo-properties.json`, if it exists | 🟥 No | `false` | |
| 47 | +| `dry-run-enabled` | Flag to dry-run the script, will not commit in repo. | 🟥 No | `false` | |
| 48 | +| `commit-author-name` | Author Name on the commit that will be created | ✅ Yes | - | |
| 49 | +| `commit-author-email` | Author Email on the commit that will be created | ✅ Yes | - | |
| 50 | +| `commit-author-gpg-key-contents` | GPG Key for the commit that will be created (must match the `email`) | ✅ Yes | - | |
| 51 | +| `commit-author-gpg-key-passphrase` | GPG Key Passphrase for the key to sign the commit that will be created | ✅ Yes | - | |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## 🛠 Usage |
| 56 | + |
| 57 | +```yaml |
| 58 | +jobs: |
| 59 | + update-schema: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - uses: PandasWhoCode/read-all-custom-properties@1-create-an-action-to-read-all-custom-properties |
| 65 | + with: |
| 66 | + token: ${{ secrets.GH_CUSTOM_PROPS_TOKEN_WRITABLE }} |
| 67 | + overwrite-existing-file: ${{ inputs.overwrite-existing-file }} |
| 68 | + dry-run-enabled: ${{ inputs.dry-run-enabled }} |
| 69 | + commit-author-name: ${{ inputs.commit-author-name }} |
| 70 | + commit-author-email: ${{ inputs.commit-author-email }} |
| 71 | + commit-author-gpg-key-contents: ${{ secrets.GPG_KEY_CONTENTS }} |
| 72 | + commit-author-gpg-key-passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }} |
| 73 | +``` |
| 74 | +
|
| 75 | +--- |
| 76 | +
|
| 77 | +## 👤 Author |
| 78 | +
|
| 79 | +Andrew Brandt |
| 80 | +
|
| 81 | +[PandasWhoCode](https://pandaswhocode.com) |
| 82 | +
|
| 83 | + |
| 84 | +
|
| 85 | +--- |
0 commit comments