-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
Showing
25 changed files
with
1,459 additions
and
529 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,65 @@ | ||
require("dotenv").config(); | ||
const { Octokit } = require("@octokit/rest"); | ||
|
||
const octokit = new Octokit({ | ||
auth: process.env.GITHUB_TOKEN, | ||
}); | ||
|
||
async function closeIssuesForMilestone() { | ||
const owner = "jihong88"; | ||
const repo = "suneditor"; | ||
const versionName = process.env.VERSION_NAME; | ||
|
||
if (!versionName) { | ||
console.log("No version name provided"); | ||
return; | ||
} | ||
|
||
try { | ||
const milestones = await octokit.rest.issues.listMilestones({ | ||
owner, | ||
repo, | ||
state: "open", | ||
}); | ||
|
||
const milestone = milestones.data.find((m) => m.title === versionName); | ||
if (!milestone) { | ||
console.log("No matching milestone found"); | ||
return; | ||
} | ||
|
||
const issues = await octokit.issues.listForRepo({ | ||
owner, | ||
repo, | ||
state: "open", | ||
milestone: milestone.number, | ||
}); | ||
|
||
issues.data.forEach(async (issue) => { | ||
const comment = { | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
body: | ||
"Thank you for your engagement with the project.\n" + | ||
"This issue has been resolved for version " + | ||
versionName + | ||
".\n" + | ||
"If the problem persists or if you believe this issue is still relevant,\n" + | ||
"please reopen it with additional comments.", | ||
}; | ||
await octokit.issues.createComment(comment); | ||
|
||
await octokit.issues.update({ | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
state: "closed", | ||
}); | ||
}); | ||
} catch (error) { | ||
console.error(`Error while processing issues for milestone: ${error}`); | ||
} | ||
} | ||
|
||
closeIssuesForMilestone(); |
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,52 @@ | ||
require("dotenv").config(); | ||
const { Octokit } = require("@octokit/rest"); | ||
|
||
const octokit = new Octokit({ | ||
auth: process.env.GITHUB_TOKEN, | ||
}); | ||
|
||
async function closeOldIssues() { | ||
try { | ||
const owner = "jihong88"; | ||
const repo = "suneditor"; | ||
const issues = await octokit.issues.listForRepo({ | ||
owner, | ||
repo, | ||
state: "open", | ||
}); | ||
|
||
const sixWeeksAgo = new Date(); | ||
sixWeeksAgo.setDate(sixWeeksAgo.getDate() - 42); // 6 weeks | ||
|
||
for (const issue of issues.data) { | ||
const lastUpdated = new Date(issue.updated_at); | ||
if (lastUpdated < sixWeeksAgo) { | ||
const comment = { | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
body: | ||
"Thank you for your engagement with the project.\n" + | ||
"Due to a lack of activity for over 6 weeks, this issue has been automatically closed." + | ||
"\nThis is part of the process to keep the project up-to-date.\n\n" + | ||
"If a new version has been released recently, please test your scenario with that version to see if the issue persists.\n" + | ||
"If the problem still exists or if you believe this issue is still relevant, \n" + | ||
"feel free to reopen it and provide additional comments.\n\n" + | ||
"I truly appreciate your continuous interest and support for the project. Your feedback is crucial in improving its quality.", | ||
}; | ||
await octokit.issues.createComment(comment); | ||
|
||
await octokit.issues.update({ | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
state: "closed", | ||
}); | ||
} | ||
} | ||
} catch (error) { | ||
console.error(`Error while closing issues: ${error}`); | ||
} | ||
} | ||
|
||
closeOldIssues(); |
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,49 @@ | ||
name: Deploy Management Action | ||
|
||
on: | ||
push: | ||
branches: | ||
- release | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12" | ||
registry-url: "https://registry.npmjs.org/" | ||
|
||
- name: Check if version has been updated | ||
id: check-version | ||
run: | | ||
PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
LAST_GIT_TAG=$(git describe --tags --abbrev=0) | ||
if [ "v$PACKAGE_VERSION" == "$LAST_GIT_TAG" ]; then | ||
echo "Package version ($PACKAGE_VERSION) has not been updated since the last tag ($LAST_GIT_TAG)." | ||
exit 1 | ||
else | ||
echo "Package version has been updated to $PACKAGE_VERSION." | ||
fi | ||
- name: Install dependencies | ||
run: npm install && npm audit fix | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Deploy | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Execute script for milestone | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION_NAME: ${{ steps.check-version.outputs.package_version }} | ||
run: node .github/scripts/manage-deploy.js $VERSION_NAME | ||
|
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,14 @@ | ||
name: Issue Management Action | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
manage-issues: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run script to manage issues | ||
run: node .github/scripts/manage-issues.js | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
|
@@ -14,4 +14,5 @@ bower_components/** | |
|
||
#dev | ||
.git/** | ||
package-lock.json | ||
package-lock.json | ||
/.vs |
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
Large diffs are not rendered by default.
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
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,5 @@ | ||
import { Lang } from './Lang'; | ||
|
||
declare const fa: Lang; | ||
|
||
export default fa; |
Oops, something went wrong.