-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into all-contributors/add-thevijayshankersharma
- Loading branch information
Showing
11 changed files
with
230 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Comment on Issue Close | ||
|
||
on: | ||
issues: | ||
types: [closed] | ||
|
||
jobs: | ||
greet-on-close: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
steps: | ||
- name: Greet User | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const issue = context.payload.issue; | ||
const issueCreator = issue.user.login; | ||
const issueNumber = issue.number; | ||
const greetingMessage = `Hello @${issueCreator}! Your issue #${issueNumber} has been closed. Thank you for your contribution!`; | ||
github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issueNumber, | ||
body: greetingMessage | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const puppeteer = require('puppeteer'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
async function takeScreenshot(username) { | ||
const url = `https://github.com/${username}`; | ||
const browser = await puppeteer.launch(); | ||
const page = await browser.newPage(); | ||
await page.goto(url); | ||
|
||
await page.setViewport({ width: 1280, height: 800 }); | ||
const screenshotPath = path.join('screenshots', `${username}.png`); | ||
await page.screenshot({ path: screenshotPath, fullPage: true }); | ||
|
||
await browser.close(); | ||
return screenshotPath; | ||
} | ||
|
||
async function main() { | ||
const username = process.argv[2]; | ||
if (!username) { | ||
console.error('No username provided'); | ||
process.exit(1); | ||
} | ||
|
||
if (!fs.existsSync('screenshots')) { | ||
fs.mkdirSync('screenshots'); | ||
} | ||
|
||
const screenshotPath = await takeScreenshot(username); | ||
console.log(`Screenshot taken for ${username}: ${screenshotPath}`); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Close Old Issues | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
close-issues: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Close Old Issues | ||
run: | | ||
open_issues=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues?state=open" \ | ||
| jq -r '.[] | .number') | ||
for issue in $open_issues; do | ||
# Get the last updated timestamp of the issue | ||
last_updated=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/$issue" \ | ||
| jq -r '.updated_at') | ||
days_since_update=$(( ( $(date +%s) - $(date -d "$last_updated" +%s) ) / 86400 )) | ||
if [ $days_since_update -gt 30 ]; then | ||
curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-d '{"state":"closed"}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/$issue" | ||
# Add a comment explaining when the issue will be closed | ||
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-d '{"body":"This issue has been automatically closed because it has been inactive for more than 30 days. If you believe this is still relevant, feel free to reopen it or create a new one. Thank you!"}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/$issue/comments" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 15 days.' | ||
days-before-pr-stale: 15 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Capture GitHub Profile Screenshot | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
capture-screenshot: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install Puppeteer | ||
run: npm install puppeteer | ||
|
||
- name: Capture Screenshot | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: node capture-screenshot.js ${{ github.event.issue.user.login }} | ||
|
||
- name: Upload Screenshot | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: screenshot | ||
path: screenshots/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const puppeteer = require('puppeteer'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
async function takeScreenshot(username) { | ||
const url = `https://github.com/${username}`; | ||
const browser = await puppeteer.launch(); | ||
const page = await browser.newPage(); | ||
await page.goto(url); | ||
|
||
await page.setViewport({ width: 1280, height: 800 }); | ||
const screenshotPath = path.join('screenshots', `${username}.png`); | ||
await page.screenshot({ path: screenshotPath, fullPage: true }); | ||
|
||
await browser.close(); | ||
return screenshotPath; | ||
} | ||
|
||
async function main() { | ||
const username = process.argv[2]; | ||
if (!username) { | ||
console.error('No username provided'); | ||
process.exit(1); | ||
} | ||
|
||
if (!fs.existsSync('screenshots')) { | ||
fs.mkdirSync('screenshots'); | ||
} | ||
|
||
const screenshotPath = await takeScreenshot(username); | ||
console.log(`Screenshot taken for ${username}: ${screenshotPath}`); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|