diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c4c397..1fb3b3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.23' + go-version-file: 'go.mod' cache: true - name: Download dependencies diff --git a/.github/workflows/issue-reply.yml b/.github/workflows/issue-reply.yml new file mode 100644 index 0000000..7414cd5 --- /dev/null +++ b/.github/workflows/issue-reply.yml @@ -0,0 +1,49 @@ +name: Issue Reply + +on: + issues: + types: [opened] + +jobs: + greet: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Greet new issue + uses: actions/github-script@v7 + with: + script: | + const issue = context.payload.issue; + const author = issue.user.login; + + // 检查是否是首次提 issue + const { data: issues } = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + creator: author, + state: 'all' + }); + + const isFirstIssue = issues.length === 1; + + let comment; + if (isFirstIssue) { + comment = `👋 Hi @${author}! Thanks for opening your first issue here! + +We'll review it as soon as possible. While waiting, please make sure: +- You've provided enough details about the issue +- Any error messages are included in full +- For feature requests, describe your use case + +Thanks for your feedback!`; + } else { + comment = `👋 Thanks @${author} for opening this issue! We'll take a look soon.`; + } + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + body: comment + }); diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..b1da623 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,44 @@ +name: Stale Issue Handler + +on: + schedule: + - cron: '0 0 * * *' # 每天运行一次 + workflow_dispatch: # 手动触发 + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + # Issue settings + stale-issue-message: | + ⚠️ This issue has been inactive for 30 days. + + If this is still relevant, please add a comment; otherwise it will be closed in 7 days. + close-issue-message: | + 🔒 This issue has been automatically closed due to inactivity. + + If this is still relevant, feel free to reopen or create a new issue. + stale-issue-label: 'stale' + days-before-issue-stale: 30 + days-before-issue-close: 7 + + # PR settings + stale-pr-message: | + ⚠️ This PR has been inactive for 60 days. + + If this change is still needed, please update the code or add a comment; otherwise it will be closed in 7 days. + close-pr-message: | + 🔒 This PR has been automatically closed due to inactivity. + stale-pr-label: 'stale' + days-before-pr-stale: 60 + days-before-pr-close: 7 + + # 豁免标签 + exempt-issue-labels: 'pinned,security,enhancement' + exempt-pr-labels: 'pinned,security'