singhJasvinder101 / MyBlog

Let's connect and explore the tech together
https://tech-stuffs.netlify.app/
14 stars 47 forks source link

Added workflows #125

Closed thevijayshankersharma closed 3 months ago

thevijayshankersharma commented 3 months ago

Pull Request Template

Description

Adds functionality to create custom workflows within the project management system to automate task transitions, notifications, and actions based on predefined conditions and triggers.

Fixes #109

Type of change

Please delete options that are not relevant.

Checklist:

Screenshots (if applicable):

Add any screenshots of your changes, if applicable.

netlify[bot] commented 3 months ago

Deploy request for tech-stuffs pending review.

Visit the deploys page to approve it

Name Link
Latest commit 1b82b7e8d3a4df4474f4184c1ede9163e42d3c6b
github-actions[bot] commented 3 months ago

Thank you for submitting your pull request! πŸ™Œ We'll review it as soon as possible. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

github-actions[bot] commented 3 months ago

Thank you @thevijayshankersharma, for your valuable time and contribution to our MyBlog! πŸ’—

It’s our MyBlog, so let’s build this MyBlog together!! 🀝

Hoping to see more of your contributions soon. πŸ˜‡

Wishing you all the best on your journey into Open Source! πŸš€

thevijayshankersharma commented 3 months ago

Add level 2 to it because level3 will not be considered for workflows. And share the discord link if you have, I need guidance so that I can contribute in the code.

singhJasvinder101 commented 3 months ago

Add level 2 to it because level3 will not be considered for workflows. And share the discord link if you have, I need guidance so that I can contribute in the code.

https://discordapp.com/users/752543690425106522

singhJasvinder101 commented 3 months ago

image

thevijayshankersharma commented 3 months ago

paste this code and check or should I raise new PR for it ??

name: Close Stale PRs

on:
  schedule:
    - cron: '0 0 * * *' # Runs daily at midnight
  pull_request:
    types:
      - opened
      - reopened
      - synchronize

permissions:
  pull-requests: write
  issues: write

jobs:
  close_stale_prs:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write

    steps:
    - uses: actions/stale@v7
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 30 days.'
        days-before-pr-stale: 30  # Adjusted to 30 days
        days-before-pr-close: 0
        exempt-pr-author: false
        exempt-pr-labels: ''
        only-labels: ''
        operations-per-run: 30
        remove-stale-when-updated: true
        debug-only: false
thevijayshankersharma commented 3 months ago

or else try this one

name: Close PRs Without Linked Issues

on:
  schedule:
    - cron: "0 0 * * *"

jobs:
  close_prs_without_issue:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '14'  # Use the desired Node.js version

      - name: Install dependencies
        run: npm install @actions/github  # Install required GitHub API library

      - name: Close PRs Without Linked Issues
        run: |
          const daysThreshold = 30;

          const github = require('@actions/github');

          async function closePRs() {
            const octokit = github.getOctokit(process.env.GITHUB_TOKEN);

            const owner = github.context.repo.owner;
            const repo = github.context.repo.repo;

            const { data: pullRequests } = await octokit.pulls.list({ owner, repo, state: 'open' });

            for (const pr of pullRequests) {
              const { data: issues } = await octokit.issues.listForRepo({ owner, repo, per_page: 100 });

              const linkedIssue = issues.find(issue =>
                issue.pull_request && issue.pull_request.url === pr.url
              );

              if (!linkedIssue) {
                await octokit.pulls.update({ owner, repo, pull_number: pr.number, state: 'closed' });
                await octokit.issues.createComment({
                  owner,
                  repo,
                  issue_number: pr.number,
                  body: "This pull request has been closed because it does not mention the issue that it solves. Please refer to the [Contributing files](https://github.com/Sulagna-Dutta-Roy/GGExtensions/blob/master/CONTRIBUTING.md) to help you add this information. Then, tag the maintainers so your PR can be reopened."
                });
              }
            }
          }

          closePRs();
singhJasvinder101 commented 3 months ago

you can create new pr with correct code.

singhJasvinder101 commented 3 months ago

Also add these lines along with the new issue greet

1) Check if the issue already exists before creating a new one. 2) Review your code carefully before making pull requests. 3) If there are any errors in the setup, please check the prerequisites and add your configuration to the environment variables in .env as provided in .env.example.