diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..5843606 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ +--- +name: "Issue Template" +about: "Use this template for reporting a bug, suggesting an enhancement, or requesting a feature." +title: "[ISSUE] - Short Description" +labels: bug, enhancement, question +assignees: '' +--- + +## 📝 Description + + +### 📷 Screenshot or Visual Reference (optional) + + +## 🐛 Bug Report (if applicable) + +- **Steps to Reproduce:** + 1. Step 1 + 2. Step 2 + 3. Step 3 +- **Expected behavior:** What should happen? +- **Actual behavior:** What happened instead? +- **Environment (if applicable):** + - Browser/OS: + - Device: + +## 💡 Enhancement / Feature Request (if applicable) + + +## 🌐 Additional Context + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..f994ebf --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,40 @@ +# Pull Request Template + +## Description + +Please include a summary of the changes and the related issue(s) this pull request addresses. Include any relevant context or background information. + +Fixes: #[issue_number] (replace with the issue number, if applicable) + +Use [x] to represent a checked (ticked) box.✅ +Use [ ] to represent an unchecked box.❌ + +## Type of Change + +- [ ] Question Added +- [ ] Solution Added +- [ ] Bug fix +- [ ] New feature +- [ ] Documentation update +- [ ] Other (please specify): + +## How to Test + +Provide a brief description of how to test your changes. Include steps, commands, or screenshots if necessary. + +1. Step 1 +2. Step 2 +3. Step 3 + +## Checklist + +- [ ] I have performed a self-review of my code. +- [ ] I have commented my code, particularly in hard-to-understand areas. +- [ ] I have made corresponding changes to the documentation (if applicable). +- [ ] My changes generate no new warnings. +- [ ] I have added tests to cover my changes (if applicable). +- [ ] All new and existing tests pass. + +## Additional Notes + +Please add any other information that is relevant to this pull request, including potential risks, alternative solutions considered, or future improvements. diff --git a/.github/workflows/autoAssign.yml b/.github/workflows/autoAssign.yml new file mode 100644 index 0000000..3f19b5c --- /dev/null +++ b/.github/workflows/autoAssign.yml @@ -0,0 +1,105 @@ +name: Auto Assign Issues and PRs + +on: + pull_request: + types: [opened, reopened] # Trigger on opened and reopened PRs + issues: + types: [opened] # Trigger on issue opened events + +permissions: + issues: write + pull-requests: write + +jobs: + auto-assign: + runs-on: ubuntu-latest + + steps: + # Step to add logging for debugging + - name: Log context for debugging + uses: actions/github-script@v6 + with: + script: | + console.log(JSON.stringify(context.payload, null, 2)); // Log the entire payload for debugging + + - name: Assign the issue or PR + uses: actions/github-script@v6 + with: + script: | + const assignee = context.payload.sender.login; // Get the username of the contributor + console.log("Assigning to: ", assignee); // Log the assignee for debugging + + if (context.eventName === 'pull_request') { + // Check if the contributor has permissions to update the pull request + const pullRequestNumber = context.payload.pull_request.number; + + // Assign the pull request to the contributor + await github.rest.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pullRequestNumber, // PRs are also issues, hence issue_number is used + assignees: [assignee] + }); + + } else if (context.eventName === 'issues') { + // Assign the issue to the contributor + const issueNumber = context.payload.issue.number; + + await github.rest.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + assignees: [assignee] + }); + } + + + + + +# name: Auto Assign Issues and PRs + +# on: +# pull_request: +# types: [opened, reopened] +# issues: +# types: [opened] + +# permissions: +# issues: write +# pull-requests: write + +# jobs: +# auto-assign: +# runs-on: ubuntu-latest + +# steps: +# # Step to add logginggg +# - name: Log context for debugging +# uses: actions/github-script@v6 +# with: +# script: | +# console.log(JSON.stringify(context.payload, null, 2)); // Log the entire payload for debugging + +# - name: Assign the issue or PR +# uses: actions/github-script@v6 +# with: +# script: | +# const assignee = context.payload.sender.login; // Get the username of the contributor +# console.log("Assigning to: ", assignee); // Log the assignee for debugging + +# if (context.eventName === 'pull_request') { +# await github.rest.pulls.update({ +# owner: context.repo.owner, +# repo: context.repo.repo, +# pull_number: context.payload.pull_request.number, +# assignees: [assignee] // Assign the pull request to the contributor +# }); +# } else if (context.eventName === 'issues') { +# await github.rest.issues.addAssignees({ +# owner: context.repo.owner, +# repo: context.repo.repo, +# issue_number: context.payload.issue.number, +# assignees: [assignee] // Assign the issue to the contributor +# }); +# } diff --git a/.github/workflows/autoLabling.yml b/.github/workflows/autoLabling.yml new file mode 100644 index 0000000..f7377e6 --- /dev/null +++ b/.github/workflows/autoLabling.yml @@ -0,0 +1,233 @@ +name: Auto Label Issues and PRs + +permissions: + issues: write + pull-requests: write + +on: + pull_request: + types: + - opened + issues: + types: + - opened + +jobs: + auto-label: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Add default labels to PRs + if: github.event_name == 'pull_request' + uses: actions/github-script@v6 + with: + script: | + const labels = ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest']; + if (labels.length > 0) { + github.rest.issues.addLabels({ + issue_number: context.payload.pull_request.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: labels + }); + } else { + console.log("No labels to add for PR"); + } + + - name: Add default labels to Issues + if: github.event_name == 'issues' + uses: actions/github-script@v6 + with: + script: | + const labels = ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest']; + if (labels.length > 0) { + github.rest.issues.addLabels({ + issue_number: context.payload.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: labels + }); + } else { + console.log("No labels to add for Issues"); + } + + label-prs: + runs-on: ubuntu-latest + outputs: + label: ${{ steps.set-label.outputs.label }} + + steps: + - name: Determine PR Label + id: set-label + run: | + if [[ "${{ github.event.pull_request.title }}" =~ bug ]]; then + echo "::set-output name=label::bug" + elif [[ "${{ github.event.pull_request.title }}" =~ documentation ]]; then + echo "::set-output name=label::documentation" + elif [[ "${{ github.event.pull_request.title }}" =~ enhancement ]]; then + echo "::set-output name=label::enhancement" + elif [[ "${{ github.event.pull_request.title }}" =~ hacktoberfest ]]; then + echo "::set-output name=label::hacktoberfest" + fi + + label-issues: + runs-on: ubuntu-latest + outputs: + label: ${{ steps.set-label.outputs.label }} + + steps: + - name: Determine Issue Label + id: set-label + run: | + if [[ "${{ github.event.issue.title }}" =~ bug ]]; then + echo "::set-output name=label::bug" + elif [[ "${{ github.event.issue.title }}" =~ "Something isn't working" ]]; then + echo "::set-output name=label::'Something isn't working'" + elif [[ "${{ github.event.issue.title }}" =~ documentation ]]; then + echo "::set-output name=label::documentation" + elif [[ "${{ github.event.issue.title }}" =~ "Improvements or additions to documentation" ]]; then + echo "::set-output name=label::'Improvements or additions to documentation'" + elif [[ "${{ github.event.issue.title }}" =~ duplicate ]]; then + echo "::set-output name=label::duplicate" + elif [[ "${{ github.event.issue.title }}" =~ enhancement ]]; then + echo "::set-output name=label::enhancement" + elif [[ "${{ github.event.issue.title }}" =~ "good first issue" ]]; then + echo "::set-output name=label::'good first issue'" + elif [[ "${{ github.event.issue.title }}" =~ hacktoberfest ]]; then + echo "::set-output name=label::hacktoberfest" + elif [[ "${{ github.event.issue.title }}" =~ question ]]; then + echo "::set-output name=label::question" + fi + +# name: Auto Label Issues and PRs + +# permissions: +# issues: write +# pull-requests: write + +# on: +# pull_request: +# types: +# - opened +# issues: +# types: +# - opened + +# jobs: +# auto-label: +# runs-on: ubuntu-latest + +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 + +# - name: Add default labels to PRs +# if: github.event_name == 'pull_request' +# uses: actions/github-script@v6 +# with: +# script: | +# github.rest.issues.addLabels({ +# issue_number: context.payload.pull_request.number, +# owner: context.repo.owner, +# repo: context.repo.repo, +# labels: ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest'] +# }) + +# - name: Add default labels to Issues +# if: github.event_name == 'issues' +# uses: actions/github-script@v6 +# with: +# script: | +# github.rest.issues.addLabels({ +# issue_number: context.payload.issue.number, +# owner: context.repo.owner, +# repo: context.repo.repo, +# labels: ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest'] +# }) + +# label-prs: +# runs-on: ubuntu-latest +# outputs: +# label: ${{ steps.set-label.outputs.label }} + +# steps: +# - name: Determine PR Label +# id: set-label +# run: | +# if [[ "${{ github.event.pull_request.title }}" =~ bug ]]; then +# echo "::set-output name=label::bug" +# elif [[ "${{ github.event.pull_request.title }}" =~ documentation ]]; then +# echo "::set-output name=label::documentation" +# elif [[ "${{ github.event.pull_request.title }}" =~ enhancement ]]; then +# echo "::set-output name=label::enhancement" +# elif [[ "${{ github.event.pull_request.title }}" =~ hacktoberfest ]]; then +# echo "::set-output name=label::hacktoberfest" +# fi + +# label-issues: +# runs-on: ubuntu-latest +# outputs: +# label: ${{ steps.set-label.outputs.label }} + +# steps: +# - name: Determine Issue Label +# id: set-label +# run: | +# if [[ "${{ github.event.issue.title }}" =~ bug ]]; then +# echo "::set-output name=label::bug" +# elif [[ "${{ github.event.issue.title }}" =~ "Something isn't working" ]]; then +# echo "::set-output name=label::Something isn't working" +# elif [[ "${{ github.event.issue.title }}" =~ documentation ]]; then +# echo "::set-output name=label::documentation" +# elif [[ "${{ github.event.issue.title }}" =~ "Improvements or additions to documentation" ]]; then +# echo "::set-output name=label::Improvements or additions to documentation" +# elif [[ "${{ github.event.issue.title }}" =~ duplicate ]]; then +# echo "::set-output name=label::duplicate" +# elif [[ "${{ github.event.issue.title }}" =~ enhancement ]]; then +# echo "::set-output name=label::enhancement" +# elif [[ "${{ github.event.issue.title }}" =~ "good first issue" ]]; then +# echo "::set-output name=label::good first issue" +# elif [[ "${{ github.event.issue.title }}" =~ hacktoberfest ]]; then +# echo "::set-output name=label::hacktoberfest" +# elif [[ "${{ github.event.issue.title }}" =~ question ]]; then +# echo "::set-output name=label::question" +# fi + +# # name: Auto Label for PRs and Issues + +# # permissions: +# # issues: write +# # pull-requests: write + +# # on: +# # pull_request: +# # types: +# # - opened +# # issues: +# # types: +# # - opened + +# # jobs: +# # auto-label: +# # runs-on: ubuntu-latest + +# # steps: +# # - name: Checkout repository +# # uses: actions/checkout@v3 + +# # - name: Add "contributor" label to PRs +# # if: github.event_name == 'pull_request' +# # uses: actions-ecosystem/action-add-labels@v1 +# # with: +# # github_token: ${{ secrets.GITHUB_TOKEN }} +# # labels: "contributor" + +# # - name: Add "issue" label to Issues +# # if: github.event_name == 'issues' +# # uses: actions-ecosystem/action-add-labels@v1 +# # with: +# # github_token: ${{ secrets.GITHUB_TOKEN }} +# # labels: "issue" diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..d8c90b8 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,34 @@ +name: 'Greetings' + +on: + push: + branches: + - '**' # Trigger on all branches for push events + issues: + types: [opened] # Trigger on issue opened events + pull_request: + branches: + - '**' # Trigger on pull request opened for all branches + types: [opened] # Trigger on pull request events like opened, reopened if needed + +permissions: + issues: write + pull-requests: write # Ensure pull request permissions are explicitly set to 'write' + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: EddieHubCommunity/gh-action-community/src/welcome@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} # Ensure the token is set + issue-message: | + Welcome, @${{ github.actor }}! Thanks for raising the issue. + Soon the maintainers/owner will review it and provide you with feedback/suggestions. + Make sure to **star this awesome repository** and **follow the account** for updates! + pr-message: | + Great job, @${{ github.actor }}! Thanks for creating the pull request. + Soon the maintainers/owner will review it and provide you with feedback/suggestions. + Make sure to **star this awesome repository** and **follow the account** for updates! + footer: 'Make sure to stay involved and contribute to the project!'