-
Notifications
You must be signed in to change notification settings - Fork 202
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-dinxsh
- Loading branch information
Showing
7 changed files
with
92 additions
and
40 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 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 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: '14' | ||
|
||
- 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 @@ | ||
|