Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Durgesh4993 authored Apr 28, 2024
1 parent 8fa06b1 commit 9155168
Show file tree
Hide file tree
Showing 15 changed files with 1,095 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/annoucement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Issue Announcement
on:
workflow_dispatch:

jobs:
issue-announcement:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

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

- name: Comment on opened issues
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const hackwithus = `\n @${context.payload.sender.login} here, \n Hope you are enjoying this hacktober 😀 \n We are excited to share that we are opening issue from our side where you will be going to add games on our website 🚀 \n Work on this [issue](https://github.com/kunjgit/GameZone/issues/2944) 🔥 \n and help us building GameZone 💗 \n if you still haven't joined us join us on ⁠[Discord](https://discord.gg/fgwk4XZfxG) \n See you soon 😊`;
const commentBody = `\n @${context.payload.sender.login} here, \n We have this annoucement to make 📢!! \n 💥 Special Announcement: \nIt's the **Call to all the designers** 🔥 🎨 \nAs you all know that GameZone has crossed 100 games 💗 , it's time that we all come up together and make the UI even better!!\nWe are redesigning the thumbnails, make sure you come up with the aesthetic and cool ideas 🚀 !\nYou are supposed to share the 4 different templates that can be used. Make sure that the size is: **1280 px X 720 px.** \nThe frame should be such that there is only a single image of the game that's taking up the major portion of the frame. Any kind of text should not be there. \n **The design should be catchy and aesthetic!** 🔥 \n\n **Note:** You are not supposed to create any issue right now for the same. \nYou have to share different designs right now in ⁠[Discord](https://discord.gg/fgwk4XZfxG) and Project Admin would be selecting one design and would be assigning the issue. After that only, you have to start working on it.`;
const hacktoberfest = `\n @${context.payload.sender.login} here, \n Hope you are doing extremely well 😇 \n It's confirmed 🥳, GameZone is taking part in hacktoberfest and ready to have another 💥 \n Ready to have some amazing contributions once again also thank you for you support in GSSoC23 you have took us on top 5 ❤️‍🔥 \n if you still haven't joined us join us on ⁠[Discord](https://discord.gg/fgwk4XZfxG) \n See you soon 😊`;
// Get the list of opened issues excluding pull requests
const { data: issues } = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
per_page: 100, // Adjust the per_page value as per your requirements
issue_type: 'issue'
});
// Comment on each opened issue (excluding pull requests)
for (const issue of issues) {
if (!issue.pull_request) {
const opener = issue.user.login;
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: `Hey @${opener} 👋!\n ${hackwithus}\n\n`
});
console.log(`Commented on issue #${issue.number}.`);
}
}
72 changes: 72 additions & 0 deletions .github/workflows/assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Assign on Comment
on:
issue_comment:
types:
- created

jobs:
assign:
runs-on: ubuntu-latest

steps:
- name: Check if /assign command is present
id: check_command
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const commentBody = context.payload.comment.body;
const assignCommand = '/assign';
const isCommandPresent = commentBody.includes(assignCommand);
console.log(`Command present: ${isCommandPresent}`);
console.log(`Comment: ${commentBody}`);
console.log(`Issue Number: ${context.payload.issue.number}`);
console.log(`Issue State: ${context.payload.issue.state}`);
console.log(`Assignees: ${context.payload.issue.assignees.map(assignee => assignee.login)}`);
console.log(`Issue URL: ${context.payload.issue.html_url}`);
console.log(`Comment URL: ${context.payload.comment.html_url}`);
console.log(`Comment Author: ${context.payload.comment.user.login}`);
console.log(`Repository: ${context.repo.owner}/${context.repo.repo}`);
console.log(`Repository URL: ${context.payload.repository.html_url}`);
console.log(`Repository Full Name: ${context.payload.repository.full_name}`);
console.log(`Repository Name: ${context.payload.repository.name}`);
console.log(`Repository Owner: ${context.payload.repository.owner.login}`);
console.log(`Repository Owner URL: ${context.payload.repository.owner.html_url}`);
console.log(`Event Name: ${context.eventName}`);
const commentAuthor = context.payload.comment.user.login;
core.setOutput('comment_author', commentAuthor);
const isGreetingFromOwner = commentAuthor === context.payload.repository.owner.login;
core.setOutput('is_greeting_from_owner', isGreetingFromOwner.toString());
const isAlreadyAssigned = context.payload.issue.assignees.length > 0;
core.setOutput('is_already_assigned', isAlreadyAssigned.toString());
if (isCommandPresent && isGreetingFromOwner) {
console.log('Skipping assigning issue: Greeting from repository owner.');
console.log(`::set-output name=assign_issue::false`);
} else if (isCommandPresent && isAlreadyAssigned) {
const { owner, repo, number } = context.issue;
const assignees = context.payload.issue.assignees.map(assignee => assignee.login).join(', ');
const commentBody = `Hey @${commentAuthor} ! , This issue is already assigned to @${assignees}. 💗 \n You can work on other issues 🚀 \n If there is anything wrong you can contact us on [Discord🕹️](https://discord.gg/fgwk4XZfxG)👀`;
await github.issues.createComment({ owner, repo, issue_number: number, body: commentBody });
console.log(`Commented on the issue: ${commentBody}.`);
console.log(`::set-output name=assign_issue::false`);
} else if (isCommandPresent) {
console.log(`::set-output name=assign_issue::true`);
} else {
console.log(`::set-output name=assign_issue::false`);
}
- name: Assign the issue
if: steps.check_command.outputs.assign_issue == 'true'
id: assign_issue
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const { owner, repo, number } = context.issue;
const assignee = context.payload.comment.user.login;
await github.issues.addAssignees({ owner, repo, issue_number: number, assignees: [assignee] });
console.log(`Assigned the issue to ${assignee}.`);
59 changes: 59 additions & 0 deletions .github/workflows/close_invalid_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Close Issues Without Keywords
on:
issues:
types:
- opened

jobs:
close-issue:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

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

- name: Close issue without keywords
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const keywords = ['Documentation Bug', 'New game', 'Enhancement', 'Bug', 'Question'];
const issueTitle = context.payload.issue.title ? context.payload.issue.title.toLowerCase() : '';
const openerUsername = context.payload.issue.user.login;
let containsKeyword = false;
for (const keyword of keywords) {
if (issueTitle.includes(keyword.toLowerCase())) {
containsKeyword = true;
break;
}
}
if (!containsKeyword) {
const commentBody = `Hey @${openerUsername}! 🙂 \n It seems like you are not following proper guidelines !! 👀 \n Read documentation properly !!🙏 \n If you have any queries reach out to us on [Discord🕹️](https://discord.gg/fgwk4XZfxG) .`;
// Close the issue
await github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: 'closed'
});
// Add comment to the issue
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
console.log('Closed the issue and added a comment.');
} else {
console.log('Issue contains one of the keywords. Skipping...');
}
98 changes: 98 additions & 0 deletions .github/workflows/close_old_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Close Older Issues

on:
workflow_dispatch:

jobs:
close-older-issues:
runs-on: ubuntu-latest

steps:
- 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 --prefix .github octokit

- name: Fetch opened issues
id: fetch_issues
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const oneWeekAgo = new Date();
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
let allIssues = [];
let page = 1;
let stopFetching = false;
while (!stopFetching) {
const { data: issues } = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
sort: 'created',
direction: 'asc',
per_page: 100,
page
});
for (const issue of issues) {
if (issue.pull_request === undefined && new Date(issue.created_at) < oneWeekAgo) {
allIssues.push(issue);
} else {
stopFetching = true;
break;
}
}
page++;
}
const olderIssues = allIssues.filter(issue => issue.pull_request === undefined);
core.setOutput('older_issues', olderIssues.map(issue => issue.number).join(','));
- name: Close older issues and comment
if: steps.fetch_issues.outputs.older_issues != ''
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const olderIssueNumbers = '${{ steps.fetch_issues.outputs.older_issues }}'.split(',');
for (const issueNumber of olderIssueNumbers) {
// Get the issue details
const { data: issue } = await github.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: parseInt(issueNumber)
});
// Close the older issue
await github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: parseInt(issueNumber),
state: 'closed'
});
// Comment on the closed issue
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: parseInt(issueNumber),
body: `Hello @${issue.user.login}, Time's Uppp!⏰ \n Sorry for closing your issue! \n But it's more than a week since we haven't received anything from your side 😢 . \n Come up with new ideas, create a new issue and make sure you finish it within a week! 🔥 \n All the best! 🚀 \n Happy Hacking! 💗`
});
console.log(`Closed and commented on issue #${issueNumber}.`);
}
- name: Skip if no older issues
if: steps.fetch_issues.outputs.older_issues == ''
run: echo "No older issues found. Skipping..."
66 changes: 66 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# name: "CodeQL"

# on:
# push:
# branches: [ "main" ]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ "main" ]
# schedule:
# - cron: '43 3 * * 6'

# jobs:
# analyze:
# name: Analyze
# runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
# timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
# permissions:
# actions: read
# contents: read
# security-events: write

# strategy:
# fail-fast: false
# matrix:
# language: [ 'javascript' ]
# # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# # Use only 'java' to analyze code written in Java, Kotlin or both
# # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# # Initializes the CodeQL tools for scanning.
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v2
# with:
# languages: ${{ matrix.language }}
# # If you wish to specify custom queries, you can do so here or in a config file.
# # By default, queries listed here will override any specified in a config file.
# # Prefix the list here with "+" to use these queries and those in the config file.

# # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# # queries: security-extended,security-and-quality


# # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# # If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# # ℹ️ Command-line programs to run using the OS shell.
# # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# # If the Autobuild fails above, remove it and uncomment the following three lines.
# # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# # - run: |
# # echo "Run, Build Application using script"
# # ./location_of_script_within_repo/buildscript.sh

# - name: Perform CodeQL Analysis
# uses: github/codeql-action/analyze@v2
# with:
# category: "/language:${{matrix.language}}"
Loading

0 comments on commit 9155168

Please sign in to comment.