on是下拉多选框

  • push
  • pull_request
  • on: workflow_dispatch 手动触发
  • on create 创建分支或tag运行
  • on delete 删除分支或标记
  • on: discussion: types:[]
    • created- edited- deleted- transferred- pinned- unpinned- labeled- unlabeled- locked- unlocked- category_changed - answered - unanswered
    • 针对这些操作,当然需要过滤
  • on: discussion_comment: types: [created, deleted]
    • 针对的是评论
  • on fork
  • on issue_comment 对评论的操作
  • on issues types
      • opened- edited- deleted- transferred- pinned- unpinned- closed- reopened- assigned- unassigned- labeled- unlabeled- locked- unlocked- milestoned - demilestoned
    • 对issues的操作
  • on pull_request 里面也很复杂
  • on pull_request_review ```yaml on: issue_comment: types: [created, deleted]

对于 comment 的操作,不是 pr 就是 comment

on: issue_comment

jobs: pr_commented:

  1. # This job only runs for pull request comments
  2. name: PR comment
  3. if: ${{ github.event.issue.pull_request }}
  4. runs-on: ubuntu-latest
  5. steps:
  6. - run: |
  7. echo "Comment on PR #${{ github.event.issue.number }}"

issue_commented:

  1. # This job only runs for issue comments
  2. name: Issue comment
  3. if: ${{ !github.event.issue.pull_request }}
  4. runs-on: ubuntu-latest
  5. steps:
  6. - run: |
  7. echo "Comment on issue #${{ github.event.issue.number }}"
  1. github.event
  2. ```javascript
  3. var o={
  4. name: "xx",
  5. on: {
  6. push: {
  7. branches: ["master"],
  8. },
  9. pull_request: {
  10. branches: ["master"],
  11. },
  12. schedule:[{
  13. cron:'xxx'
  14. }]
  15. },
  16. },
  1. name: Weekly Team Sync
  2. on:
  3. schedule:
  4. - cron: 20 07 * * 1
  5. jobs:
  6. create_issue:
  7. name: Create team sync issue
  8. runs-on: ubuntu-latest
  9. permissions:
  10. issues: write
  11. steps:
  12. - name: Create team sync issue
  13. uses: imjohnbo/issue-bot@3daae12aa54d38685d7ff8459fc8a2aee8cea98b
  14. with:
  15. assignees: "monalisa, doctocat, hubot"
  16. labels: "weekly sync, docs-team"
  17. title: "Team sync"
  18. body: |
  19. ### Agenda
  20. - [ ] Start the recording
  21. - [ ] Check-ins
  22. - [ ] Discussion points
  23. - [ ] Post the recording
  24. ### Discussion Points
  25. Add things to discuss below
  26. - [Work this week](https://github.com/orgs/github/projects/3)
  27. pinned: false
  28. close-previous: false
  29. env:
  30. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  1. - name: Close issue
  2. uses: actions-cool/issues-helper@v2.2.1
  3. with:
  4. actions: 'close-issue'
  5. token: ${{ secrets.GITHUB_TOKEN }}
  6. issue-number: xxx
  7. body: 'This is auto closed.'

https://docs.github.com/cn/rest/reference/issues