-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ajay-dhangar:main' into main
- Loading branch information
Showing
11 changed files
with
943 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,62 @@ | ||
name: Auto Greeting for Issues and PRs | ||
name: "Auto Greeting for Issues and PRs" | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
pull_request: | ||
pull_request_target: | ||
types: [opened] | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
greeting: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Post Greeting Message | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const isIssue = !!context.payload.issue; | ||
const isPR = !!context.payload.pull_request; | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
const greetingMessage = ` | ||
👋 Hello @${isIssue ? context.payload.issue.user.login : context.payload.pull_request.user.login}, welcome! | ||
- name: Greet first-time contributors | ||
id: greet | ||
uses: actions/first-interaction@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: | | ||
👋 Hi @${{ github.actor }}! Thank you for opening your first issue on the Algo project. We're excited to help you out and appreciate your contribution. Please provide as much detail as possible to assist us in addressing the issue effectively. | ||
Welcome aboard! 😊 | ||
pr-message: | | ||
👋 Hi @${{ github.actor }}! Thank you for submitting your first pull request to the Algo project. Great job on the contribution! 🎉 We appreciate your efforts, and our team will review it soon. If you have any questions, feel free to ask. Keep up the great work! 🚀 | ||
Thank you for opening this ${isIssue ? "issue" : "pull request"}. We appreciate your effort in helping to improve our Algo project. Our team will review it shortly. In the meantime, if you can provide any additional information or context, feel free to update this ${isIssue ? "issue" : "PR"}. | ||
- name: Assign issue or pull request to a team member | ||
if: github.event_name == 'issues' || github.event_name == 'pull_request_target' | ||
run: | | ||
ISSUE_NUMBER=${{ github.event.issue.number || github.event.pull_request.number }} | ||
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-d '{"assignees":["team-member-username"]}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}" | ||
Please refer to our [CONTRIBUTING.md](https://github.com/ajay-dhangar/algo/blob/main/CONTRIBUTING.md) for guidelines on contributing to this project. | ||
- name: Welcome message for community contributors | ||
if: github.event_name == 'issues' || github.event_name == 'pull_request_target' | ||
uses: EddieHubCommunity/gh-action-community/src/welcome@main | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-message: "👋 Hi @${{ github.actor }}! Thanks for opening this issue. We appreciate your contribution to the Algo project. Our team will review it soon." | ||
pr-message: "🎉 Great job, @${{ github.actor }}! Thank you for submitting your pull request. We appreciate your contribution, and our team will review it shortly." | ||
|
||
Thank you for your contribution! 🚀😊 | ||
`; | ||
- name: Label first-time issues | ||
if: github.event_name == 'issues' | ||
run: | | ||
ISSUE_NUMBER=${{ github.event.issue.number }} | ||
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-d '{"labels":["Algo Contributor's Issue"]}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}" | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: isIssue ? context.issue.number : context.payload.pull_request.number, | ||
body: greetingMessage | ||
}); | ||
- name: Label first-time pull requests | ||
if: github.event_name == 'pull_request_target' | ||
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-d '{"labels":["Algo Contributor's PR"]}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}" |
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,68 @@ | ||
name: Lighthouse Report | ||
|
||
on: | ||
pull_request_target: | ||
branches: | ||
- main | ||
- algo-v** | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lighthouse-report: | ||
permissions: | ||
pull-requests: write # for marocchino/sticky-pull-request-comment | ||
name: Lighthouse Report | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Use Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build website | ||
run: npm run build | ||
|
||
- name: Audit URLs using Lighthouse | ||
id: lighthouse_audit | ||
uses: treosh/[email protected] | ||
with: | ||
urls: | | ||
http://localhost:3000/algo/ | ||
http://localhost:3000/algo/docs | ||
http://localhost:3000/algo/blog | ||
configPath: ./.github/workflows/lighthouserc.json | ||
uploadArtifacts: true | ||
temporaryPublicStorage: true | ||
|
||
- name: Format lighthouse score | ||
id: format_lighthouse_score | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const results = ${{ steps.lighthouse_audit.outputs.manifest }} | ||
const links = ${{ steps.lighthouse_audit.outputs.links }} | ||
const createLighthouseReport = (await import(`${process.env.GITHUB_WORKSPACE}/admin/scripts/formatLighthouseReport.js`)).default; | ||
const comment = createLighthouseReport({ results, links }); | ||
core.setOutput("comment", comment); | ||
- name: Add Lighthouse stats as comment | ||
id: comment_to_pr | ||
uses: marocchino/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
number: ${{ github.event.pull_request.number }} | ||
header: lighthouse | ||
message: ${{ steps.format_lighthouse_score.outputs.comment }} |
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,20 @@ | ||
{ | ||
"ci": { | ||
"collect": { | ||
"startServerCommand": "npm run serve", | ||
"startServerReadyPattern": "Serving", | ||
"startServerReadyTimeout": 10000, | ||
"numberOfRuns": 1, | ||
"settings": { | ||
"skipAudits": [ | ||
"robots-txt", | ||
"canonical", | ||
"tap-targets", | ||
"is-crawlable", | ||
"works-offline", | ||
"offline-start-url" | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.