Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPDATE: Added github workflow for contributors #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/update-contributors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update Contributors

on:
push:
branches:
- master
jobs:
update-readme:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Checkout Repository
uses: actions/checkout@v2

- name: Set Up Node.js
uses: actions/setup-node@v2
with:
node-version: 14

- name: Install Dependencies
run: npm install

- name: Update Contributors
run: node update-readme.js

- name: Commit Changes
run: |
git config --local user.email "<your-email-address>"
git config --local user.name "<your-github-username>"
git add README.md
git commit -m "Update contributors in README"
git push
6 changes: 6 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### List of contributors

| Name | Image |
| ------------- | ------------------------------- |
| Advaita Saha | ![Avaita Saha](https://avatars.githubusercontent.com/u/30210770?v=4) |
| Bartick Maiti | ![Bartick Maiti](https://avatars.githubusercontent.com/u/69100224?v=4) |
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ npm start
```


<!-- CONTRIBUTORS START -->
<!-- CONTRIBUTORS END -->

## 🤝 Contributing

Contributions to EthUnwrapped are welcome! If you would like to contribute, please follow these steps:
Expand Down
21 changes: 21 additions & 0 deletions update-readme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const fs = require("fs");

// creating a function that updates the readme automatically
function updateReadme() {
// read the contributors content
const contributorsContent = fs.readFileSync("CONTRIBUTORS.md", "utf8");
// reading the readme content
const readmeContent = fs.readFileSync("README.md", "utf8");

// update the readme
const updatedReadme = readmeContent.replace(
/<!-- CONTRIBUTORS START -->([\s\S]*?)<!-- CONTRIBUTORS END -->/,
`<!-- CONTRIBUTORS START -->\n\n${contributorsContent}\n<!-- CONTRIBUTORS END -->`
);

// re-writing the README
fs.writeFileSync('README.md', updatedReadme);
}

// running the function
updateReadme();