Skip to content

Commit

Permalink
chore: small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MishraSomesh001 committed Mar 23, 2024
1 parent e8a2da1 commit aa17598
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 62 deletions.
27 changes: 0 additions & 27 deletions .github/Contributor_Guide/Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,7 @@ If you want to contribute to net_worth_mate, submit a pull request.
- url: `https://github.com/OPCODE-Open-Spring-Fest/net_worth_mate/compare/branch...YOURGITHUBUSERNAME:net_worth_mate:BRANCH?quick_pull=1&template=pr.md`

### Requirements
To run *net_worth_mate*, you need the following requirements:

- [Node.js](https://nodejs.org/)


### Setup

To set up *net_worth_mate* on your local machine, follow these steps:

## Installation Steps

1. Fork the repository:
- Click the "Fork" button at the top right corner of this repository's page on GitHub. This will create a copy of the repository in your GitHub account.

2. Clone the forked repository:

```bash
git clone https://github.com/<yourusername>/net_worth_mate.git
```


3. Navigate to the project directory:
```bash
cd net_worth_mate
```

4. Install Node.js dependencies:
```bash
npm i
```
Congratulations! You have successfully set up *net_worth_mate* on your machine.
69 changes: 35 additions & 34 deletions .github/Contributor_Guide/Project_Tour.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
# Project Tour

In the 'Contracts' folder, you'll find a single file with a '.sol' extension. This file is where you should make all your changes. Simply open this file to access the contract code and update it as needed. If you have any questions or need assistance with the changes, feel free to ask!.
In the 'Contracts' folder, you'll find a single file with a '.sol' extension. This file is where you should make all your changes. Simply open this file to access the contract code and update it as needed. If you have any questions or need assistance with the changes, feel free to ask!

```bash
| .gitignore
| CODE_OF_CONDUCT.md
| commitlint.config.js
| package-lock.json
| package.json
| README.md
|
+---.github
| +---Contributor_Guide
| | commiting.md
| | Contributing.md
| | Project_Tour.md
| |
| +---ISSUE_TEMPLATE
| | bug_report.yaml
| | feature_request.yaml
| |
| +---PULL_REQUEST_TEMPLATE
| | pr.md
| |
| \---workflows
| commitlint.yaml
| prmerged.yaml
|
+---.husky
| commit-msg
| pre-commit
|
\---contracts
│ .gitignore
│ CODE_OF_CONDUCT.md
│ commitlint.config.js
│ package-lock.json
│ package.json
│ README.md
├───.github
│ │ pull_request_template.md
│ │
│ ├───Contributor_Guide
│ │ commiting.md
│ │ Contributing.md
│ │ Project_Tour.md
│ │
│ ├───ISSUE_TEMPLATE
│ │ bug_report.yaml
│ │ feature_request.yaml
│ │
│ ├───PULL_REQUEST_TEMPLATE
│ │ pr.md
│ │
│ └───workflows
│ checklabels.yaml
│ commitlint.yaml
│ label-checker.js
│ prmerged.yaml
├───.husky
│ commit-msg
│ pre-commit
└───contracts
net_worth_mate.sol

```
#Tech stack :
Solidity
```
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

## Description

> Give a brief description of the pull request.
## Semver Changes

- [ ] Patch (bug fix, no new features)
- [ ] Minor (new features, no breaking changes)
- [ ] Major (breaking changes)

## Issues

> List any issues that this pull request closes.
## Checklist

- [ ] I have read the [Contributing Guidelines](../Contributor_Guide/Contruting.md).

21 changes: 21 additions & 0 deletions .github/workflows/checklabels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Label Checker

on:
pull_request:
types: [opened, edited, synchronize, reopened, labeled, unlabeled]

jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm install @actions/github @actions/core
- name: Run Label Checker
run: node .github/workflows/label-checker.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/label-checker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { getOctokit, context } from '@actions/github';
import { setFailed } from '@actions/core';

async function run() {
try {
const token = process.env.GITHUB_TOKEN;
const octokit = new getOctokit(token);

const pullRequest = context.payload.pull_request;
const owner = pullRequest.base.repo.owner.login;
const repo = pullRequest.base.repo.name;
const pullNumber = pullRequest.number;

const { data: labels } = await octokit.rest.issues.listLabelsOnIssue({
owner,
repo,
issue_number: pullNumber,
});

const labelNames = labels.map((label) => label.name);

const requiredLabels = [
['Type:Easy', 'Type:Medium', 'Type:Hard'],
['Semver:major', 'Semver:minor', 'Semver:patch'],
['PR:Accept'],
];

const hasRequiredLabels = requiredLabels.every((labelGroup) =>
labelGroup.some((label) => labelNames.includes(label))
);

if (!hasRequiredLabels) {
setFailed(
'This pull request must have at least one label from each of the following groups: Type (Easy, Medium, Hard), Semver (Major, Minor, Patch), and PR:Accept.'
);
}
} catch (error) {
setFailed(error.message);
}
}

run();
2 changes: 1 addition & 1 deletion .github/workflows/prmerged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
API_AUTH_TOKEN: ${{ secrets.API_AUTH_TOKEN }}
run: |
payload=$(echo '{"owner":"${{ steps.get-pr-data.outputs.owner }}","labels":"${{ steps.get-pr-data.outputs.labels }}","repository_name":"${{ steps.get-pr-data.outputs.repo_name }}","repository_url":"${{ steps.get-pr-data.outputs.repo_url }}"}')
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_AUTH_TOKEN" -d "$payload" "$API_URL"
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_AUTH_TOKEN" -d "$payload" "$API_URL"

0 comments on commit aa17598

Please sign in to comment.