Skip to content

Commit 9ad7c7a

Browse files
committed
Initial Files added
1 parent 68bfa29 commit 9ad7c7a

File tree

9 files changed

+193
-9
lines changed

9 files changed

+193
-9
lines changed

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## My Pledge
4+
5+
In the interest of fostering an open and welcoming environment, I as
6+
contributor and maintainer pledge to making participation in my project and
7+
my community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity, and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## My Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct that could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## My Responsibilities
35+
36+
The project maintainer is responsible for clarifying the standards of acceptable
37+
behavior and is expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
The project maintainer has the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by the project maintainer.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing or otherwise unacceptable behavior may be
58+
reported by contacting the project maintainer at [LinkedIn](https://www.linkedin.com/in/kaustubh-gupta). All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project maintainer is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainer who does not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Contributing to PortFolioFy
2+
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
3+
4+
Contributions are always appreciated as **no contribution is too small.**
5+
**We are here to learn and grow along with the community**
6+
7+
8+
# Submitting Contributions
9+
- **Perfom all the initials:** Fork the repo, clone your version locally, add upstream to my repo `https://github.com/kaustubhgupta/readme-projects-display`, create a new branch. If you're not aware of all these terminologies, there are ton of resources available on internet.
10+
11+
- **Choosing the Issue:** You can create issues for bugs, new features, documentation errors or anything you want to add. Open a new issue and we will have the discussion about it.
12+
13+
- **Local Setup:** Python needs to installed beforehand. Other than this, you should create a new environment for this project and install all the requirements via pip ( `pip install -r requirements.txt`)
14+
15+
16+
**Important:** Make sure to check the docs for more detailed descriptions of various parameters and files used.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Kaustubh
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
![readme-projects-display](https://socialify.git.ci/kaustubhgupta/readme-projects-display/image?description=1&font=KoHo&forks=1&issues=1&language=1&owner=1&pattern=Floating%20Cogs&pulls=1&stargazers=1&theme=Light)
2+
<p align="center">
3+
<img src="https://img.shields.io/badge/python%20-%2314354C.svg?&style=for-the-badge&logo=python&logoColor=white" align="center">
4+
<img src="https://img.shields.io/badge/markdown-%23000000.svg?&style=for-the-badge&logo=markdown&logoColor=white" align="center">
5+
<img src="https://img.shields.io/badge/github%20actions%20-%232671E5.svg?&style=for-the-badge&logo=github%20actions&logoColor=white "align="center">
6+
</p>
7+
8+
GitHub's Profile readme is a great tool to showcase your skills and projects to potential recruiters/developers. This GitHub action allows you to update a particular section of README with your Project details. These include the project name, stars, and a controllable amount of description.
9+
10+
<p align="center">
11+
<img src="./images/preview.png" align="center">
12+
</p>
13+
14+
## Getting Your Profile Ready
15+
16+
- Add this comment in your README.md/specified file:
17+
```
18+
<!-- PROJECTS START -->
19+
<!-- PROJECTS END -->
20+
```
21+
22+
- The repositories need to have `project` topic to add them to the project section.
23+
24+
- A GitHub personal access token will be needed which can be obtained by going to Settings > Developer Settings > Personal Access Tokens.
25+
<div align="center"> <img src="./images/config.png" align="center"> </div>
26+
27+
_Note: If you give personal repositories access then they will be added to the sections but their links will not work for others_
28+
29+
30+
## Action Setup
31+
32+
GitHub actions can be integrated in any repository. Create a new folder called `.github/workflows/<any-name>.yml`. Paste the following starter code:
33+
34+
```yml
35+
name: Update Projects
36+
on:
37+
schedule:
38+
- cron: '0 0 * * *'
39+
# This makes the action to run at the end of every day. Customize this accordingly or you can also trigger this action for GitHub events (Pull, Push). Check the GitHub actions page for that.
40+
workflow_dispatch:
41+
# workflow_dispatch allows you to trigger the action any time manually
42+
43+
jobs:
44+
update-readme-with-projects:
45+
name: Update this repo's README with latest project updates
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v2
49+
- uses: kaustubhgupta/readme-projects-display@master
50+
with:
51+
gh_token: ${{ secrets.TOKEN }} # Create a secret to store the access token
52+
```
53+
54+
## Available Options
55+
_Note: The whole documentation of the action will be updated soon_
56+
57+
| Option | Default Value | Description | Required | Example |
58+
| -------------- | ------------- | ---------------------------------------------------------------------------- | -------- | ------- |
59+
| `gh_token` | NA | GitHub Personal Access token | Yes | NA |
60+
| `file_name` | `README.md` | Name of the readme file or any other file containing the comment mentioned above. Note: The file needs to be in root of repository. (Dynamic paths coming in next version!) | No | myfile.txt/ myfile.html |
61+
| `max_repo_description` | 50 | How much description you want to Display | No | 40 |
62+
63+
64+
## Examples
65+
- [My Workflow File](https://github.com/kaustubhgupta/kaustubhgupta/blob/master/.github/workflows/updaters.yml)
66+
67+
**Happy?? Do Star ⭐ this Repo. 🤩**
68+
69+
## License
70+
71+
[![MIT Licence](https://img.shields.io/github/license/kaustubhgupta/PortfolioFy)](https://choosealicense.com/licenses/mit/)

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ inputs:
99
description: "Name of the file"
1010
required: False
1111
default: README.md
12+
max_repo_description:
13+
description: "How much description you want to Display"
14+
required: False
15+
default: 50
1216

1317
runs:
1418
using: "composite"
1519
steps:
1620
- run: python -m pip install PyGithub
1721
shell: bash
18-
- run: python ${{ github.action_path }}/main-script.py ${{ inputs.gh_token }} ${{ inputs.file_name }} ${{ github.workspace }}
22+
- run: python ${{ github.action_path }}/main-script.py ${{ inputs.gh_token }} ${{ inputs.file_name }} ${{ github.workspace }} ${{ inputs.max_repo_description }}
1923
shell: bash
2024
branding:
2125
icon: "award"

images/config.png

48.8 KB
Loading

images/preview.png

58.3 KB
Loading

main-script.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ def rewriteContents(old_content, new_content):
1212
new_content)
1313
return r.sub(new_content_formated, old_content)
1414

15-
16-
root = pathlib.Path(__file__).parent.resolve()
1715
git = Github(sys.argv[1])
1816
start = git.rate_limiting[0]
17+
max_repo_description = int(sys.argv[4])
1918
print(f'Request left at start of the script: {start}')
2019

2120
user_object = git.get_user()
@@ -32,7 +31,7 @@ def rewriteContents(old_content, new_content):
3231
repo_topics = repo_object.get_topics()
3332
if len(repo_topics) != 0:
3433
if 'project' in repo_topics:
35-
project_data[f'{repo}'] = {'repo_description': repo_object.description if len(repo_object.description) < 50 else repo_object.description[:50] + '...',
34+
project_data[f'{repo}'] = {'repo_description': repo_object.description if len(repo_object.description) < max_repo_description else repo_object.description[:max_repo_description] + '...',
3635
'repo_stars': int(repo_object.stargazers_count),
3736
'repo_link': f'https://github.com/{git_username}/{repo}'
3837
}
@@ -70,14 +69,10 @@ def rewriteContents(old_content, new_content):
7069

7170
newContent = ' '.join(newContent)
7271
rewrittenReadme = rewriteContents(readme, newContent)
73-
print(repoName)
74-
print(readme_path)
75-
print(readme)
76-
print(readmeRepo)
7772
print("=====================RESULTS=============================")
7873
if rewrittenReadme != readme:
7974
print("Repo Contents Updated")
8075
readmeRepo.update_file(contents.path, "Updating Projects Section",
8176
rewrittenReadme, contents.sha)
8277
else:
83-
print("No change detected in file contents")
78+
print("No change detected in file contents")

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PyGithub==1.53

0 commit comments

Comments
 (0)