-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0f7a8bc
Showing
9 changed files
with
11,780 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "Run" | ||
|
||
on: | ||
workflow_dispatch: | ||
watch: | ||
types: [started,fork] | ||
schedule: | ||
- cron: "*/30 * * * *" | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- run: npm i | ||
- uses: ./ | ||
with: | ||
githubToken: ${{ secrets.GITHUBTOKEN }} | ||
actor: ${{ github.actor }} |
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 @@ | ||
* @actions/actions-runtime |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Tran Nguyen Thuong Truong | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Empty file.
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,12 @@ | ||
name: "a_repo_with_x_stars_and_y_forks" | ||
description: "Rename this repo" | ||
inputs: | ||
githubToken: | ||
description: "Your Github Token" | ||
required: true | ||
actor: | ||
description: "Actor name" | ||
outputs: {} | ||
runs: | ||
using: "node12" | ||
main: "index.js" |
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 @@ | ||
const core = require("@actions/core"), | ||
github = require("@actions/github"); | ||
getInfor = require('./infor.js') | ||
|
||
function toOrd(e) { | ||
const t = ["th", "st", "nd", "rd"], | ||
o = e % 100; | ||
return e + (t[(o - 20) % 10] || t[o] || t[0]) | ||
} | ||
async function run() { | ||
try { | ||
const e = core.getInput("githubToken"), | ||
t = core.getInput("actor") || "", | ||
o = github.getOctokit(e), | ||
n = "thuongtruong1009"; | ||
let a = [], | ||
r = 1; | ||
for (;;) { | ||
const e = await o.request("GET /users/{username}/repos", { username: n, type: "public", page: r, per_page: 100, mediaType: { previews: ["mercy"] } }); | ||
if (r += 1, 0 === e.data.length) break; | ||
const t = e.data.map(e => ({ name: e.name, full_name: e.full_name, stargazers_count: e.stargazers_count, forks_count: e.forks_count })); | ||
a = a.concat(t.filter(e => e.name.includes("a_repo_with_"))) | ||
} | ||
a.forEach(async({ full_name: e, stargazers_count: n, forks_count: a }) => { | ||
const [r, s] = e.split("/"), c = `a_repo_with_${n}_stars_and_${a}_forks`, i = `a repo with ${n} stars ⭐️ and ${a} forks <br/> ${getInfor()}`, u = `- [${t}](https://github.com/${t}) helped me reach ${toOrd(n)} stars and ${toOrd(a)} forks.`; | ||
let m = await o.request("GET /repos/{owner}/{repo}/contents/{path}", { owner: r, repo: s, path: "README.md" }), | ||
p = new Buffer(m.data.content, "base64").toString().split("\n"); | ||
if (p[p.length - 1] == u || p[p.length - 2] == u) { | ||
const e = `# ${i}` + "\n" + (p = p.slice(0, -2)).slice(1).join("\n"); | ||
await o.request("PUT /repos/{owner}/{repo}/contents/{path}", { owner: r, repo: s, path: "README.md", message: `⭐️ ${n}`, content: Buffer.from(e).toString("base64"), sha: m.data.sha, author: { name: t, email: `${t}@users.noreply.github.com` }, committer: { name: "Tran Nguyen Thuong Truong", email: "ititiu19228@student.hcmiu.edu.vn" } }), m = await o.request("GET /repos/{owner}/{repo}/contents/{path}", { owner: r, repo: s, path: "README.md" }) | ||
} else await o.request("PATCH /repos/{owner}/{repo}", { owner: r, repo: s, name: c, description: 'Automatic change repository name with stars and forks count' }); | ||
const l = `# ${i}` + "\n" + p.slice(1).join("\n") + "\n" + u + "\n"; | ||
await o.request("PUT /repos/{owner}/{repo}/contents/{path}", { owner: r, repo: s, path: "README.md", message: `chore: update README with ⭐️ ${n}`, content: Buffer.from(l).toString("base64"), sha: m.data.sha, author: { name: t, email: `${t}@users.noreply.github.com` }, committer: { name: "Tran Nguyen Thuong Truong", email: "ititiu19228@student.hcmiu.edu.vn" } }) | ||
}) | ||
} catch (e) { core.setFailed(e.message) } | ||
} | ||
run(); |
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,61 @@ | ||
const infor = [ | ||
`## Package | ||
:heavy_check_mark: [@actions/core](packages/core) | ||
Provides functions for inputs, outputs, results, logging, secrets and variables. Read more [here](packages/core) | ||
:octocat: [@actions/github](packages/github) | ||
Provides an Octokit client hydrated with the context that the current action is being run in. Read more [here](packages/github) | ||
See more at [action/toolkit](https://github.com/actions/toolkit) and [action/javascript](https://github.com/actions/javascript-action) | ||
## References | ||
- Relax with [bee-music](https://github.com/thuongtruong1009/bee-music) | ||
- Enhance Vuejs skills through [e-shopee](https://github.com/thuongtruong1009/e-shopee) | ||
- Starting Quasar framework with [twitter-meta](https://github.com/thuongtruong1009/twitter-meta) | ||
- Generate your GitHub informations by [gitbox](https://github.com/thuongtruong1009/gitbox) | ||
- Begining Vue through [notedev](https://github.com/thuongtruong1009/notedev) | ||
- Learning front-end web full course at [frontend-master](https://github.com/thuongtruong1009/frontend-master) | ||
- Learn Object-Oriented-Programming tutorial at [Snake-Game-OOP](https://github.com/thuongtruong1009/Snake-Game-OOP) | ||
- Become Java master for new beginner at [Java-training](https://github.com/thuongtruong1009/java-oop-training) | ||
- Pratice UI/UX at [league-fo-legend](https://github.com/thuongtruong1009/league-of-legends-clone) | ||
- Make flip card game at [flip-card](https://github.com/thuongtruong1009/flip-cards) | ||
- Learn computer architecture at [computer-architecture](https://github.com/thuongtruong1009/computer-architecture) | ||
## ❤️ [Support me](https://www.paypal.me/thuongtruong1009) | ||
> We are looking for sponsors to join us to have better community reach and impact. | ||
[![MOMO](https://img.shields.io/badge/-MOMO-red?style=flat&labelColor=RED&logo=MOMO&logoColor=black)](https://nhantien.momo.vn/0917085937) | ||
<a href="https://www.paypal.me/thuongtruong1009"> | ||
<img height="25" marginTop="10" src="https://www.paypalobjects.com/digitalassets/c/website/marketing/apac/C2/logos-buttons/optimize/26_Blue_PayPal_Pill_Button.png"></a> | ||
<a href='https://ko-fi.com/thuongtruong1009' target='_blank'> | ||
<img height='25' style='border:0px;height:28px;color:blue' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> | ||
## 📰 [License](LICENSE) | ||
- ##### This project is distributed under the [MIT License](LICENSE). | ||
- ##### 2022-PRESENT © [Tran Nguyen Thuong Truong](https://github.com/thuongtruong1009) | ||
--- | ||
## Generation details` | ||
]; | ||
|
||
export const getInfor = () => infor.forEach(item => item) |
Oops, something went wrong.