Skip to content

Commit

Permalink
update workflows files.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Aug 8, 2024
1 parent ad396de commit db2c4ab
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/issue-translator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'issue-translator'
on:
issue_comment:
types: [created]
issues:
types: [opened]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: usthe/[email protected]
with:
BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
IS_MODIFY_TITLE: true
# not require, default false, . Decide whether to modify the issue title
# if true, the robot account @Issues-translate-bot must have modification permissions, invite @Issues-translate-bot to your project or use your custom bot.
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ
# not require. Customize the translation robot prefix message.
58 changes: 58 additions & 0 deletions .github/workflows/reopen-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Reopen and Update Stale Issues

on:
workflow_dispatch: # ζ‰‹εŠ¨θ§¦ε‘

jobs:
reopen_stale_issues:
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Fetch Closed Issues with lifecycle/stale Label
id: fetch_issues
uses: actions/[email protected]
with:
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
script: |
const issues = await github.paginate(github.rest.issues.listForRepo, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed',
labels: 'lifecycle/stale',
per_page: 100
});
return JSON.stringify(issues.map(issue => issue.number));
result-encoding: string

- name: Reopen and Remove Label
uses: actions/[email protected]
with:
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
script: |
const issueNumbers = JSON.parse(`{{ steps.fetch_issues.outputs.result }}`);
for (const issue_number of issueNumbers) {
// Reopen the issue
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
state: 'open'
});
console.log(`Reopened issue #${issue_number}`);
// Remove the lifecycle/stale label
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
name: 'lifecycle/stale'
});
console.log(`Removed label 'lifecycle/stale' from issue #${issue_number}`);
}

0 comments on commit db2c4ab

Please sign in to comment.