Unrestricted CSDN login script not work #23
This file contains hidden or 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
| name: issue ci | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| create-branch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create branch | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.QWY_SYNC_BOT_TOKEN }} | |
| script: | | |
| const issue = context.payload.issue; | |
| const issueTitle = issue.title.replace(/[^a-zA-Z0-9]/g, '_'); | |
| const issueNumber = issue.number; | |
| const issuett = issue.title; | |
| const username = issue.user.login; | |
| const branchName = `${username}_${issuett}_${issueNumber}`; | |
| console.log(`Branch ${issuett} created successfully!`); | |
| // 获取主分支的 SHA | |
| const { data: refData } = await github.rest.git.getRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: 'heads/main', // 基于主分支创建新分支 | |
| }); | |
| // 创建新分支 | |
| await github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `refs/heads/${branchName}`, | |
| sha: refData.object.sha, | |
| }); | |
| console.log(`Branch ${branchName} created successfully!`); | |
| assign: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 自动分配问题到人民的勤务员 | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.QWY_SYNC_BOT_TOKEN }} | |
| script: | | |
| const issueOwner = context.repo.owner; | |
| github.rest.issues.addAssignees({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| assignees: [issueOwner] | |
| }); |