Skip to content

Commit 2cc65f5

Browse files
committed
feat: Initial Commit
**Description**: - Add the generate-custom-properties-schema.sh - Add CODE_OF_CONDUCT - Add SECURITY - Add dependabot config - Add README - Add CONTRIBUTING - .gitignore Signed-off-by: Roger Barker <[email protected]>
1 parent 291eed1 commit 2cc65f5

File tree

8 files changed

+372
-0
lines changed

8 files changed

+372
-0
lines changed

.github/SECURITY.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
We take the security of generate-custom-properties-schema seriously. If you believe you have found a security vulnerability,
6+
please report it to us as described below.
7+
8+
**Please do not report security vulnerabilities through public GitHub issues.**
9+
10+
Instead, please report them via email to:
11+
12+
```
13+
14+
```
15+
16+
You should receive a response within 48 hours. If for some reason you do not, please follow up via email to ensure we received
17+
your original message.
18+
19+
Please include the following information in your report:
20+
21+
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
- Full paths of source file(s) related to the manifestation of the issue
23+
- The location of the affected source code (tag/branch/commit or direct URL)
24+
- Any special configuration required to reproduce the issue
25+
- Step-by-step instructions to reproduce the issue
26+
- Proof-of-concept or exploit code (if possible)
27+
- Impact of the issue, including how an attacker might exploit it
28+
29+
## Preferred Languages
30+
31+
We prefer all communications to be in English.
32+
33+
## Policy
34+
35+
- We will respond to your report within 48 hours with our evaluation and expected resolution time
36+
- If you have followed the instructions above, we will not take legal action against you in regard to your report
37+
- We will keep you informed of the progress towards resolving the issue
38+
- Once the issue is resolved, we will publicly acknowledge your responsible disclosure, if you wish

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR Conventional Commit Validation
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
issues: write
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
validate-pr-title:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: PR Conventional Commit Validation
20+
uses: ytanikin/pr-conventional-commits@8267db1bacc237419f9ed0228bb9d94e94271a1d # v1.4.1
21+
with:
22+
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/.idea/

CODE_OF_CONDUCT.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and maintainers of this project pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, inclusive, and healthy environment.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our project include:
12+
13+
- Using welcoming and inclusive language
14+
- Being respectful of differing viewpoints and experiences
15+
- Gracefully accepting constructive criticism
16+
- Focusing on what is best for the community
17+
- Showing empathy towards other community members
18+
19+
Examples of unacceptable behavior by participants include:
20+
21+
- The use of sexualized language or imagery, and unwelcome sexual attention or advances
22+
- Trolling, insulting/derogatory comments, and personal attacks
23+
- Public or private harassment
24+
- Publishing others' private information, such as a physical or email address, without their explicit permission
25+
- Other conduct which could reasonably be considered inappropriate in a professional setting
26+
27+
## Our Responsibilities
28+
29+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
30+
31+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
32+
33+
## Scope
34+
35+
This Code of Conduct applies within all project spaces, both physical and online, when an individual is representing the project or its community. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36+
37+
This Code of Conduct also applies outside project spaces when the individual is representing the project or its community in public spaces.
38+
39+
## Enforcement
40+
41+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [[email protected]]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.
42+
43+
## Enforcement Guidelines
44+
45+
Project maintainers will follow these Community Impact Guidelines in determining the consequences for any action they deem to be in violation of this Code of Conduct:
46+
47+
- **Contribution Removal**: Violations of the Code of Conduct may result in a temporary or permanent ban on the ability to contribute to the project.
48+
- **Warning**: The offending participant may be given a warning after the first instance of inappropriate behavior.
49+
- **Temporary Ban**: If the inappropriate behavior continues, the participant may be temporarily banned from participating in the community for a period of time.
50+
- **Permanent Ban**: In extreme cases, an individual may be permanently banned from contributing to the project.
51+
52+
## Attribution
53+
54+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

CONTRIBUTING.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contributing to generate-custom-properties-schema
2+
3+
Thank you for your interest in contributing to the `generate-custom-properties-schema` project! Whether you're submitting a bug report, fixing a bug, or adding a feature, we appreciate your help in making this action better.
4+
5+
## How to Contribute
6+
7+
### Reporting Issues
8+
9+
If you've encountered a bug or have a suggestion for improvement, please check the [Issues](https://github.com/PandasWhoCode/generate-custom-properties-schema/issues) tab to see if it's already been reported. If not, feel free to open a new issue with as much detail as possible, including:
10+
11+
- A clear description of the problem or feature request.
12+
- Steps to reproduce the issue (if applicable).
13+
- The expected behavior and any error messages.
14+
- Your environment details (e.g., operating system, GitHub Actions version).
15+
16+
### Submitting a Pull Request
17+
18+
We welcome contributions through pull requests! To submit a pull request:
19+
20+
1. **Fork the repository**:
21+
Click the "Fork" button at the top of the repository page to create a copy of the project under your GitHub account.
22+
23+
2. **Clone your fork**:
24+
Clone your forked repository to your local machine:
25+
```bash
26+
git clone https://github.com/YOUR_USERNAME/generate-custom-properties-schema.git
27+
```
28+
29+
3. **Create a branch**:
30+
Create a new branch for your changes:
31+
```bash
32+
git checkout -b feature-branch
33+
```
34+
35+
4. **Make your changes**:
36+
Make your changes to the codebase. Ensure that you test your changes thoroughly and maintain existing functionality.
37+
38+
5. **Commit your changes**:
39+
Commit your changes with a clear and concise commit message. Follow the [Conventional Commit](https://www.conventionalcommits.org/) guidelines if possible.
40+
```bash
41+
git commit -m "feat: added new feature to install specific version"
42+
```
43+
44+
6. **Push your changes**:
45+
Push your changes to your forked repository:
46+
```bash
47+
git push origin feature-branch
48+
```
49+
50+
7. **Create a Pull Request**:
51+
Open a pull request (PR) from your feature branch to the `main` branch of the original repository.
52+
53+
8. **Describe your changes**:
54+
Provide a detailed description of the changes you made in the PR and link any relevant issues.
55+
56+
### Code Style
57+
58+
- Use [Prettier](https://prettier.io/) to format your code.
59+
- Ensure that your code follows the conventions and structure of the existing codebase.
60+
61+
### Testing
62+
63+
Ensure that your changes do not break existing functionality. If possible, include tests for any new features or bug fixes.
64+
65+
### Documentation
66+
67+
If you make changes that affect how the action works or how it is used, please update the documentation (including the `README.md` and this `CONTRIBUTING.md`) to reflect the changes.
68+
69+
## License
70+
71+
By contributing to this project, you agree that your contributions will be licensed under the [Apache License 2.0](https://github.com/PandasWhoCode/generate-custom-properties-schema?tab=Apache-2.0-1-ov-file#readme).
72+
73+
## Code of Conduct
74+
75+
By participating in this project, you agree to adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md). We strive to maintain a welcoming and respectful community for everyone.
76+
77+
## Thank You!
78+
79+
Your contributions are what make this project great. Thank you for helping improve `generate-custom-properties-schema`!
80+
81+
---
82+
83+
**Author**: [Roger Barker](https://github.com/DJ-BBot)
84+

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 Generate Custom Properties Schema
2+
3+
**Script for generating a custom-properties schema to be used in conjunction with PandasWhoCode action:
4+
[Configure Custom Properties](https://github.com/marketplace/actions/set-custom-properties-schema-action)**
5+
6+
You must be authenticated with GitHub and have permission to view the organization's properties.
7+
This script will generate a `custom_props.json` file that can be used to set custom properties
8+
for your GitHub organization using the existing custom properties of your organization (or another
9+
which you have appropriate permissions to view)
10+
11+
---
12+
13+
## Getting Started
14+
15+
1. Clone this Github repository
16+
2. Execute the `generate-custom-properties-schema.sh` script to create a `custom_props.json` file.
17+
3. Move the `custom_props.json` file to the `.github` directory of your repository.
18+
19+
---
20+
21+
## Requirements
22+
23+
- [`gh`](https://cli.github.com/) (GitHub CLI)
24+
- [`jq`](https://stedolan.github.io/jq/) (Command-line JSON processor)
25+
26+
Ensure these tools are installed and available in your `PATH`.
27+
28+
---
29+
30+
## Options
31+
32+
| Name | Description | Required | Default |
33+
|------|--------------------------------|------------------------|----------------------|
34+
| `-o` | Github Organization/Owner name | :white_check_mark: Yes ||
35+
| `-n` | Name for the output file | :x: No | `custom_props.json` |
36+
| `-h` | Show help | :x: No ||
37+
38+
---
39+
40+
## Usage
41+
42+
```bash
43+
./generate-custom-properties-schema.sh -o ORG [-n FILENAME]
44+
```
45+
46+
### Example Usage
47+
48+
```bash
49+
git clone --depth 1 https://github.com/PandasWhoCode/generate-custom-properties-schema.git
50+
cd generate-custom-properties-schema
51+
52+
gh auth login # follow the prompts, ensure you are logged into gh cli
53+
./generate-custom-properties-schema.sh -o MyOrganization -n my-custom-props.json
54+
55+
cp my-custom-props.json <path_to_your_repo>/.github/my-custom-props.json
56+
```
57+
58+
### Example `.github/custom_props.json`
59+
60+
`custom_props.json`:
61+
62+
```json
63+
{
64+
"properties": [
65+
{
66+
"property_name": "single_select_property",
67+
"value_type": "single_select",
68+
"allowed_values": [
69+
"option-1",
70+
"option-2",
71+
"option-3",
72+
"option-4"
73+
],
74+
"description": "Default single select property",
75+
"values_editable_by": "org_and_repo_actors",
76+
"required": false
77+
},
78+
{
79+
"property_name": "multi_select_property",
80+
"value_type": "multi_select",
81+
"allowed_values": [
82+
"option-1",
83+
"option-2",
84+
"option-3",
85+
"option-4"
86+
],
87+
"description": "Default multi select property",
88+
"values_editable_by": "org_and_repo_actors",
89+
"required": false
90+
},
91+
{
92+
"property_name": "text_property",
93+
"value_type": "string",
94+
"description": "Default 'text' property type",
95+
"values_editable_by": "org_and_repo_actors",
96+
"required": false
97+
},
98+
{
99+
"property_name": "bool_test",
100+
"value_type": "true_false",
101+
"description": "Default true-false property type",
102+
"values_editable_by": "org_and_repo_actors",
103+
"required": false
104+
}
105+
]
106+
}
107+
```
108+
109+
## 👤 Author
110+
111+
Roger Barker
112+
113+
[PandasWhoCode](https://pandaswhocode.com)
114+
115+
116+
117+
---
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# SPDX-License-Identifier: Apache-2.0
4+
# See LICENSE file in the project root for full license information.
5+
#
6+
# Generate the custom properties schema file for a github organization
7+
#
8+
# Basic assumptions:
9+
# - jq and gh are installed on the system calling this script.
10+
# - The user has access to the github organization and has the necessary permissions to view the properties.
11+
generate_custom_props_file() {
12+
13+
# Parse args
14+
while getopts ":ho:r:n:" opt; do
15+
case $opt in
16+
o) ORG="$OPTARG" ;; # Github Organization/Owner name
17+
n) NAME="$OPTARG" ;; # Filename to save the schema
18+
h) echo "Usage: generate_custom_props_file [-h] -o ORG [-n FILENAME]"; return 0 ;;
19+
\?) echo "Invalid option: -$OPTARG" >&2; return 1 ;;
20+
:) echo "Option -$OPTARG requires an argument." >&2; return 2;;
21+
esac
22+
done
23+
24+
# Error checking. Verify that required argument (ORG) is set.
25+
if [[ -z "${ORG}" ]]; then
26+
echo "Error: Organization must be specified." >&2
27+
return 3
28+
fi
29+
30+
# If no filename is specified, use the default name
31+
NAME=${NAME:-"custom_props.json"}
32+
33+
# Write the schema to a file
34+
echo "{" > "${NAME}"
35+
echo " \"properties\":" >> "${NAME}"
36+
gh api /orgs/"${ORG}"/properties/schema | jq -r 'del(.[]|.["url","source_type"])' >> "${NAME}"
37+
echo "}" >> "${NAME}"
38+
39+
# Pretty-format the JSON file using jq.
40+
cat "${NAME}" | jq . > custom_props.json.tmp
41+
mv custom_props.json.tmp "${NAME}"
42+
}
43+
44+
generate_custom_props_file "$@"
45+

0 commit comments

Comments
 (0)