Skip to main content

Events that trigger workflows

You can configure your workflows to run when specific activity on GitHub happens, at a scheduled time, or when an event outside of GitHub occurs.

About events that trigger workflows

Workflow triggers are events that cause a workflow to run. For more information about how to use workflow triggers, see Triggering a workflow.

Some events have multiple activity types. For these events, you can specify which activity types will trigger a workflow run. For more information about what each activity type means, see 웹후크 이벤트 및 페이로드.

참고 항목

Not all webhook events trigger workflows.

branch_protection_rule

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
branch_protection_rule- created
- edited
- deleted
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when branch protection rules in the workflow repository are changed. For more information about branch protection rules, see 보호된 분기 정보. For information about the branch protection rule APIs, see 개체 in the GraphQL API documentation or 분기 및 해당 설정에 대한 REST API 엔드포인트.

For example, you can run a workflow when a branch protection rule has been created or deleted:

on:
  branch_protection_rule:
    types: [created, deleted]

check_run

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
check_run- created
- rerequested
- completed
- requested_action
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when activity related to a check run occurs. A check run is an individual test that is part of a check suite. For information, see REST API를 사용하여 검사 상호 작용. For information about the check run APIs, see 개체 in the GraphQL API documentation or 검사 실행에 대한 REST API 엔드포인트.

For example, you can run a workflow when a check run has been rerequested or completed.

on:
  check_run:
    types: [rerequested, completed]

check_suite

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
check_suite- completedLast commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. Although only the completed activity type is supported, specifying the activity type will keep your workflow specific if more activity types are added in the future. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

참고 항목

To prevent recursive workflows, this event does not trigger workflows if the check suite was created by GitHub Actions.

Runs your workflow when check suite activity occurs. A check suite is a collection of the check runs created for a specific commit. Check suites summarize the status and conclusion of the check runs that are in the suite. For information, see REST API를 사용하여 검사 상호 작용. For information about the check suite APIs, see 개체 in the GraphQL API documentation or 검사 도구 모음에 대한 REST API 엔드포인트.

For example, you can run a workflow when a check suite has been completed.

on:
  check_suite:
    types: [completed]

create

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
createNot applicableLast commit on the created branch or tagBranch or tag created

참고 항목

An event will not be created when you create more than three tags at once.

Runs your workflow when someone creates a Git reference (Git branch or tag) in the workflow's repository. For information about the APIs to create a Git reference, see 변형 in the GraphQL API documentation or Git 참조에 대한 REST API 엔드포인트.

For example, you can run a workflow when the create event occurs.

on:
  create

delete

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
deleteNot applicableLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

참고 항목

An event will not be created when you delete more than three tags at once.

Runs your workflow when someone deletes a Git reference (Git branch or tag) in the workflow's repository. For information about the APIs to delete a Git reference, see 변형 in the GraphQL API documentation or Git 참조에 대한 REST API 엔드포인트.

For example, you can run a workflow when the delete event occurs.

on:
  delete

deployment

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
deploymentNot applicableCommit to be deployedBranch or tag to be deployed (empty if created with a commit SHA)

Runs your workflow when someone creates a deployment in the workflow's repository. Deployments created with a commit SHA may not have a Git ref. For information about the APIs to create a deployment, see 변형 in the GraphQL API documentation or 리포지토리에 대한 REST API 엔드포인트.

For example, you can run a workflow when the deployment event occurs.

on:
  deployment

deployment_status

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
deployment_statusNot applicableCommit to be deployedBranch or tag to be deployed (empty if commit)

참고 항목

When a deployment status's state is set to inactive, a workflow run will not be triggered.

Runs your workflow when a third party provides a deployment status. Deployments created with a commit SHA may not have a Git ref. For information about the APIs to create a deployment status, see 변형 in the GraphQL API documentation or 배포에 대한 REST API 엔드포인트.

For example, you can run a workflow when the deployment_status event occurs.

on:
  deployment_status

discussion

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
discussion- created
- edited
- deleted
- transferred
- pinned
- unpinned
- labeled
- unlabeled
- locked
- unlocked
- category_changed
- answered
- unanswered
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

참고 항목

GitHub Discussions에 대한 웹후크 이벤트는 현재 공개 미리 보기 버전이며 변경될 수 있습니다.

Runs your workflow when a discussion in the workflow's repository is created or modified. For activity related to comments on a discussion, use the discussion_comment event. For more information about discussions, see 토론 정보. For information about the GraphQL API, see 개체.

For example, you can run a workflow when a discussion has been created, edited, or answered.

on:
  discussion:
    types: [created, edited, answered]

discussion_comment

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
discussion_comment- created
- edited
- deleted
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

참고 항목

GitHub Discussions에 대한 웹후크 이벤트는 현재 공개 미리 보기 버전이며 변경될 수 있습니다.

Runs your workflow when a comment on a discussion in the workflow's repository is created or modified. For activity related to a discussion as opposed to comments on the discussion, use the discussion event. For more information about discussions, see 토론 정보. For information about the GraphQL API, see 개체.

For example, you can run a workflow when a discussion comment has been created or deleted.

on:
  discussion_comment:
    types: [created, deleted]

fork

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
forkNot applicableLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when someone forks a repository. For information about the REST API, see 포크에 대한 REST API 엔드포인트.

For example, you can run a workflow when the fork event occurs.

on:
  fork

gollum

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
gollumNot applicableLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when someone creates or updates a Wiki page. For more information, see 위키 정보.

For example, you can run a workflow when the gollum event occurs.

on:
  gollum

issue_comment

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
issue_comment- created
- edited
- deleted
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when an issue or pull request comment is created, edited, or deleted. For information about the issue comment APIs, see 개체 in the GraphQL API documentation or 웹후크 이벤트 및 페이로드 in the REST API documentation.

For example, you can run a workflow when an issue or pull request comment has been created or deleted.

on:
  issue_comment:
    types: [created, deleted]

issue_comment on issues only or pull requests only

The issue_comment event occurs for comments on both issues and pull requests. You can use the github.event.issue.pull_request property in a conditional to take different action depending on whether the triggering object was an issue or pull request.

For example, this workflow will run the pr_commented job only if the issue_comment event originated from a pull request. It will run the issue_commented job only if the issue_comment event originated from an issue.

on: issue_comment

jobs:
  pr_commented:
    # This job only runs for pull request comments
    name: PR comment
    if: ${{ github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo A comment on PR $NUMBER
        env:
          NUMBER: ${{ github.event.issue.number }}

  issue_commented:
    # This job only runs for issue comments
    name: Issue comment
    if: ${{ !github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo A comment on issue $NUMBER
        env:
          NUMBER: ${{ github.event.issue.number }}

issues

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
issues- opened
- edited
- deleted
- transferred
- pinned
- unpinned
- closed
- reopened
- assigned
- unassigned
- labeled
- unlabeled
- locked
- unlocked
- milestoned
- demilestoned
- typed
- untyped
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when an issue in the workflow's repository is created or modified. For activity related to comments in an issue, use the issue_comment event. For more information about issues, see 문제 정보. For information about the issue APIs, see 개체 in the GraphQL API documentation or 이슈에 대한 REST API 엔드포인트.

For example, you can run a workflow when an issue has been opened, edited, or milestoned.

on:
  issues:
    types: [opened, edited, milestoned]

label

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
label- created
- edited
- deleted
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when a label in your workflow's repository is created or modified. For more information about labels, see 레이블 관리. For information about the label APIs, see 개체 in the GraphQL API documentation or 레이블에 대한 REST API 엔드포인트.

If you want to run your workflow when a label is added to or removed from an issue, pull request, or discussion, use the labeled or unlabeled activity types for the issues, pull_request, pull_request_target, or discussion events instead.

For example, you can run a workflow when a label has been created or deleted.

on:
  label:
    types: [created, deleted]

merge_group

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
merge_groupchecks_requestedSHA of the merge groupRef of the merge group

참고 항목

  • 둘 이상의 활동 유형이 이 이벤트를 트리거합니다. Although only the checks_requested activity type is supported, specifying the activity type will keep your workflow specific if more activity types are added in the future. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.
  • 리포지토리에서 GitHub Actions을(를) 사용하여 필요한 검사 을(를) 통해 워크플로가 필요한 경우 merge_group 이벤트를 추가 트리거로 포함하도록 워크플로를 업데이트해야 합니다. 그렇지 않으면 병합 큐에 끌어오기 요청을 추가할 때 상태 검사가 트리거되지 않습니다. 상태 확인 필요가 보고되지 않으므로 병합이 실패합니다. merge_group 이벤트는 pull_requestpush 이벤트트와 별개입니다.

Runs your workflow when a pull request is added to a merge queue, which adds the pull request to a merge group. For more information see 병합 큐와 끌어오기 요청 병합.

For example, you can run a workflow when the checks_requested activity has occurred.

on:
  pull_request:
    branches: [ "main" ]
  merge_group:
    types: [checks_requested]

milestone

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
milestone- created
- closed
- opened
- edited
- deleted
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when a milestone in the workflow's repository is created or modified. For more information about milestones, see 마일스톤 정보. For information about the milestone APIs, see 개체 in the GraphQL API documentation or 마일스톤에 대한 REST API 엔드포인트.

If you want to run your workflow when an issue is added to or removed from a milestone, use the milestoned or demilestoned activity types for the issues event instead.

For example, you can run a workflow when a milestone has been opened or deleted.

on:
  milestone:
    types: [opened, deleted]

page_build

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
page_buildNot applicableLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when someone pushes to a branch that is the publishing source for GitHub Pages, if GitHub Pages is enabled for the repository. For more information about GitHub Pages publishing sources, see GitHub Pages 사이트에 대한 게시 원본 구성. For information about the REST API, see 리포지토리에 대한 REST API 엔드포인트.

For example, you can run a workflow when the page_build event occurs.

on:
  page_build

public

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
publicNot applicableLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when your workflow's repository changes from private to public. For information about the REST API, see 리포지토리에 대한 REST API 엔드포인트.

For example, you can run a workflow when the public event occurs.

on:
  public

pull_request

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
pull_request- assigned
- unassigned
- labeled
- unlabeled
- opened
- edited
- closed
- reopened
- synchronize
- converted_to_draft
- locked
- unlocked
- enqueued
- dequeued
- milestoned
- demilestoned
- ready_for_review
- review_requested
- review_request_removed
- auto_merge_enabled
- auto_merge_disabled
Last merge commit on the GITHUB_REF branchPR merge branch refs/pull/PULL_REQUEST_NUMBER/merge

참고 항목

  • 둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened. To trigger workflows by different activity types, use the types keyword. For more information, see Workflow syntax for GitHub Actions.
  • Workflows will not run on pull_request activity if the pull request has a merge conflict. The merge conflict must be resolved first. Conversely, workflows with the pull_request_target event will run even if the pull request has a merge conflict. Before using the pull_request_target trigger, you should be aware of the security risks. For more information, see pull_request_target.
  • The pull_request webhook event payload is empty for merged pull requests and pull requests that come from forked repositories.
  • The value of GITHUB_REF varies for a closed pull request depending on whether the pull request has been merged or not. If a pull request was closed but not merged, it will be refs/pull/PULL_REQUEST_NUMBER/merge. If a pull request was closed as a result of being merged, it will be the fully qualified ref of the branch it was merged into, for example /refs/heads/main.

Runs your workflow when activity on a pull request in the workflow's repository occurs. For example, if no activity types are specified, the workflow runs when a pull request is opened or reopened or when the head branch of the pull request is updated. For activity related to pull request reviews, pull request review comments, or pull request comments, use the pull_request_review, pull_request_review_comment, or issue_comment events instead. For information about the pull request APIs, see 개체 in the GraphQL API documentation or 끌어오기 요청에 대한 REST API 엔드포인트.

Note that GITHUB_SHA for this event is the last merge commit of the pull request merge branch. If you want to get the commit ID for the last commit to the head branch of the pull request, use github.event.pull_request.head.sha instead.

For example, you can run a workflow when a pull request has been opened or reopened.

on:
  pull_request:
    types: [opened, reopened]

You can use the event context to further control when jobs in your workflow will run. For example, this workflow will run when a review is requested on a pull request, but the specific_review_requested job will only run when a review by octo-team is requested.

on:
  pull_request:
    types: [review_requested]
jobs:
  specific_review_requested:
    runs-on: ubuntu-latest
    if: ${{ github.event.requested_team.name == 'octo-team'}}
    steps:
      - run: echo 'A review from octo-team was requested'

Running your pull_request workflow based on the head or base branch of a pull request

You can use the branches or branches-ignore filter to configure your workflow to only run on pull requests that target specific branches. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when someone opens a pull request that targets a branch whose name starts with releases/:

on:
  pull_request:
    types:
      - opened
    branches:
      - 'releases/**'

참고 항목

branches 필터와 paths 필터를 둘 다 사용하는 경우 두 필터가 모두 충족될 때만 워크플로가 실행됩니다. For example, the following workflow will only run when a pull request that includes a change to a JavaScript (.js) file is opened on a branch whose name starts with releases/:

on:
  pull_request:
    types:
      - opened
    branches:
      - 'releases/**'
    paths:
      - '**.js'

To run a job based on the pull request's head branch name (as opposed to the pull request's base branch name), use the github.head_ref context in a conditional. For example, this workflow will run whenever a pull request is opened, but the run_if job will only execute if the head of the pull request is a branch whose name starts with releases/:

on:
  pull_request:
    types:
      - opened
jobs:
  run_if:
    if: startsWith(github.head_ref, 'releases/')
    runs-on: ubuntu-latest
    steps:
      - run: echo "The head of this PR starts with 'releases/'"

Running your pull_request workflow based on files changed in a pull request

You can also configure your workflow to run when a pull request changes specific files. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when a pull request includes a change to a JavaScript file (.js):

on:
  pull_request:
    paths:
      - '**.js'

참고 항목

branches 필터와 paths 필터를 둘 다 사용하는 경우 두 필터가 모두 충족될 때만 워크플로가 실행됩니다. For example, the following workflow will only run when a pull request that includes a change to a JavaScript (.js) file is opened on a branch whose name starts with releases/:

on:
  pull_request:
    types:
      - opened
    branches:
      - 'releases/**'
    paths:
      - '**.js'

Running your pull_request workflow when a pull request merges

When a pull request merges, the pull request is automatically closed. To run a workflow when a pull request merges, use the pull_request closed event type along with a conditional that checks the merged value of the event. For example, the following workflow will run whenever a pull request closes. The if_merged job will only run if the pull request was also merged.

on:
  pull_request:
    types:
      - closed

jobs:
  if_merged:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
    - run: |
        echo The PR was merged

포크된 리포지토리의 워크플로

워크플로는 기본적으로 포크된 리포지토리에서 실행되지 않습니다. 포크된 리포지토리의 Actions(작업) 탭에서 GitHub Actions를 사용하도록 설정해야 합니다.

GITHUB_TOKEN의 예외를 제외하고 포크된 리포지토리에서 워크플로가 트리거될 때 비밀이 실행기에게 전달되지 않습니다. GITHUB_TOKEN에는 포크된 리포지토리 끌어오기 요청의 읽기 전용 권한이 있습니다. 자세한 내용은 Use GITHUB_TOKEN for authentication in workflows을(를) 참조하세요.

포크된 리포지토리에 대한 끌어오기 요청 이벤트

포크된 리포지토리에서 기본 리포지토리로의 끌어오기 요청의 경우 GitHub는 기본 리포지토리에 pull_request, issue_comment, pull_request_review_comment, pull_request_review, pull_request_target 이벤트를 보냅니다. 포크된 리포지토리에서는 끌어오기 요청 이벤트가 발생하지 않습니다.

처음으로 참가자가 퍼블릭 리포지토리에 끌어오기 요청을 제출하는 경우, 끌어오기 요청에 대해 쓰기 액세스 권한이 있는 유지 관리자가 실행 중인 워크플로를 승인해야 할 수 있습니다. 자세한 내용은 Approving workflow runs from forks을(를) 참조하세요.

포크된 리포지토리에서 프라이빗 리포지토리로 끌어오기 요청은 워크플로가 활성화 상태일 때만 실행됩니다. 리포지토리에 대한 GitHub Actions 설정 관리을(를) 참조하세요.

참고 항목

Dependabot 끌어오기 요청으로 트리거되는 워크플로는 포크된 리포지토리에서 온 것처럼 처리되며 관련 제한 사항도 적용됩니다.

pull_request_comment (use issue_comment)

To run your workflow when a comment on a pull request (not on a pull request's diff) is created, edited, or deleted, use the issue_comment event. For activity related to pull request reviews or pull request review comments, use the pull_request_review or pull_request_review_comment events.

pull_request_review

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
pull_request_review- submitted
- edited
- dismissed
Last merge commit on the GITHUB_REF branchPR merge branch refs/pull/PULL_REQUEST_NUMBER/merge

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

Runs your workflow when a pull request review is submitted, edited, or dismissed. A pull request review is a group of pull request review comments in addition to a body comment and a state. For activity related to pull request review comments or pull request comments, use the pull_request_review_comment or issue_comment events instead. For information about the pull request review APIs, see 개체 in the GraphQL API documentation or 끌어오기 요청에 대한 REST API 엔드포인트.

For example, you can run a workflow when a pull request review has been edited or dismissed.

on:
  pull_request_review:
    types: [edited, dismissed]

Running a workflow when a pull request is approved

To run your workflow when a pull request has been approved, you can trigger your workflow with the submitted type of pull_request_review event, then check the review state with the github.event.review.state property. For example, this workflow will run whenever a pull request review is submitted, but the approved job will only run if the submitted review is an approving review:

on:
  pull_request_review:
    types: [submitted]

jobs:
  approved:
    if: github.event.review.state == 'approved'
    runs-on: ubuntu-latest
    steps:
      - run: echo "This PR was approved"

포크된 리포지토리의 워크플로

워크플로는 기본적으로 포크된 리포지토리에서 실행되지 않습니다. 포크된 리포지토리의 Actions(작업) 탭에서 GitHub Actions를 사용하도록 설정해야 합니다.

GITHUB_TOKEN의 예외를 제외하고 포크된 리포지토리에서 워크플로가 트리거될 때 비밀이 실행기에게 전달되지 않습니다. GITHUB_TOKEN에는 포크된 리포지토리 끌어오기 요청의 읽기 전용 권한이 있습니다. 자세한 내용은 Use GITHUB_TOKEN for authentication in workflows을(를) 참조하세요.

포크된 리포지토리에 대한 끌어오기 요청 이벤트

포크된 리포지토리에서 기본 리포지토리로의 끌어오기 요청의 경우 GitHub는 기본 리포지토리에 pull_request, issue_comment, pull_request_review_comment, pull_request_review, pull_request_target 이벤트를 보냅니다. 포크된 리포지토리에서는 끌어오기 요청 이벤트가 발생하지 않습니다.

처음으로 참가자가 퍼블릭 리포지토리에 끌어오기 요청을 제출하는 경우, 끌어오기 요청에 대해 쓰기 액세스 권한이 있는 유지 관리자가 실행 중인 워크플로를 승인해야 할 수 있습니다. 자세한 내용은 Approving workflow runs from forks을(를) 참조하세요.

포크된 리포지토리에서 프라이빗 리포지토리로 끌어오기 요청은 워크플로가 활성화 상태일 때만 실행됩니다. 리포지토리에 대한 GitHub Actions 설정 관리을(를) 참조하세요.

참고 항목

Dependabot 끌어오기 요청으로 트리거되는 워크플로는 포크된 리포지토리에서 온 것처럼 처리되며 관련 제한 사항도 적용됩니다.

pull_request_review_comment

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
pull_request_review_comment- created
- edited
- deleted
Last merge commit on the GITHUB_REF branchPR merge branch refs/pull/PULL_REQUEST_NUMBER/merge

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

Runs your workflow when a pull request review comment is modified. A pull request review comment is a comment on a pull request's diff. For activity related to pull request reviews or pull request comments, use the pull_request_review or issue_comment events instead. For information about the pull request review comment APIs, see 개체 in the GraphQL API documentation or 끌어오기 요청에 대한 REST API 엔드포인트.

For example, you can run a workflow when a pull request review comment has been created or deleted.

on:
  pull_request_review_comment:
    types: [created, deleted]

포크된 리포지토리의 워크플로

워크플로는 기본적으로 포크된 리포지토리에서 실행되지 않습니다. 포크된 리포지토리의 Actions(작업) 탭에서 GitHub Actions를 사용하도록 설정해야 합니다.

GITHUB_TOKEN의 예외를 제외하고 포크된 리포지토리에서 워크플로가 트리거될 때 비밀이 실행기에게 전달되지 않습니다. GITHUB_TOKEN에는 포크된 리포지토리 끌어오기 요청의 읽기 전용 권한이 있습니다. 자세한 내용은 Use GITHUB_TOKEN for authentication in workflows을(를) 참조하세요.

포크된 리포지토리에 대한 끌어오기 요청 이벤트

포크된 리포지토리에서 기본 리포지토리로의 끌어오기 요청의 경우 GitHub는 기본 리포지토리에 pull_request, issue_comment, pull_request_review_comment, pull_request_review, pull_request_target 이벤트를 보냅니다. 포크된 리포지토리에서는 끌어오기 요청 이벤트가 발생하지 않습니다.

처음으로 참가자가 퍼블릭 리포지토리에 끌어오기 요청을 제출하는 경우, 끌어오기 요청에 대해 쓰기 액세스 권한이 있는 유지 관리자가 실행 중인 워크플로를 승인해야 할 수 있습니다. 자세한 내용은 Approving workflow runs from forks을(를) 참조하세요.

포크된 리포지토리에서 프라이빗 리포지토리로 끌어오기 요청은 워크플로가 활성화 상태일 때만 실행됩니다. 리포지토리에 대한 GitHub Actions 설정 관리을(를) 참조하세요.

참고 항목

Dependabot 끌어오기 요청으로 트리거되는 워크플로는 포크된 리포지토리에서 온 것처럼 처리되며 관련 제한 사항도 적용됩니다.

pull_request_target

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
pull_request- assigned
- unassigned
- labeled
- unlabeled
- opened
- edited
- closed
- reopened
- synchronize
- converted_to_draft
- ready_for_review
- locked
- unlocked
- enqueued
- dequeued
- review_requested
- review_request_removed
- auto_merge_enabled
- auto_merge_disabled
Last commit on the PR base branchPR base branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. By default, a workflow only runs when a pull_request_target event's activity type is opened, synchronize, or reopened. To trigger workflows by different activity types, use the types keyword. For more information, see Workflow syntax for GitHub Actions.

Runs your workflow when activity on a pull request in the workflow's repository occurs. For example, if no activity types are specified, the workflow runs when a pull request is opened or reopened or when the head branch of the pull request is updated.

This event runs in the context of the base of the pull request, rather than in the context of the merge commit, as the pull_request event does. This prevents execution of unsafe code from the head of the pull request that could alter your repository or steal any secrets you use in your workflow. This event allows your workflow to do things like label or comment on pull requests from forks. Avoid using this event if you need to build or run code from the pull request.

To ensure repository security, branches with names that match certain patterns (such as those which look similar to SHAs) may not trigger workflows with the pull_request_target event.

경고

pull_request_target 이벤트에 의해 트리거되는 워크플로의 경우 permissions 키를 지정하지 않으면 GITHUB_TOKEN에 읽기/쓰기 리포지토리 권한이 부여되고 워크플로는 포크에서 트리거되는 경우에도 비밀에 액세스할 수 있습니다. 워크플로는 끌어오기 요청의 베이스 컨텍스트에서 실행되지만 이 이벤트를 사용하여 끌어오기 요청에서 신뢰할 수 없는 코드를 체크 아웃하거나 빌드하거나 실행하지 않아야 합니다. 또한 모든 캐시는 베이스 분기와 동일한 범위를 공유합니다. 캐시 중독을 방지하기 위해 캐시 내용이 변경되었을 가능성이 있는 경우 캐시를 저장하면 안 됩니다. 자세한 내용은 GitHub Security Lab 웹 사이트에서 GitHub Actions 및 워크플로 보안 유지: pwn 요청 방지를 참조하세요.

For example, you can run a workflow when a pull request has been assigned, opened, synchronize, or reopened.

on:
  pull_request_target:
    types: [assigned, opened, synchronize, reopened]

Running your pull_request_target workflow based on the head or base branch of a pull request

You can use the branches or branches-ignore filter to configure your workflow to only run on pull requests that target specific branches. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when someone opens a pull request that targets a branch whose name starts with releases/:

on:
  pull_request_target:
    types:
      - opened
    branches:
      - 'releases/**'

참고 항목

branches 필터와 paths 필터를 둘 다 사용하는 경우 두 필터가 모두 충족될 때만 워크플로가 실행됩니다. For example, the following workflow will only run when a pull request that includes a change to a JavaScript (.js) file is opened on a branch whose name starts with releases/:

on:
  pull_request_target:
    types:
      - opened
    branches:
      - 'releases/**'
    paths:
      - '**.js'

To run a job based on the pull request's head branch name (as opposed to the pull request's base branch name), use the github.head_ref context in a conditional. For example, this workflow will run whenever a pull request is opened, but the run_if job will only execute if the head of the pull request is a branch whose name starts with releases/:

on:
  pull_request_target:
    types:
      - opened
jobs:
  run_if:
    if: startsWith(github.head_ref, 'releases/')
    runs-on: ubuntu-latest
    steps:
      - run: echo "The head of this PR starts with 'releases/'"

Running your pull_request_target workflow based on files changed in a pull request

You can use the paths or paths-ignore filter to configure your workflow to run when a pull request changes specific files. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when a pull request includes a change to a JavaScript file (.js):

on:
  pull_request_target:
    paths:
      - '**.js'

참고 항목

branches 필터와 paths 필터를 둘 다 사용하는 경우 두 필터가 모두 충족될 때만 워크플로가 실행됩니다. For example, the following workflow will only run when a pull request that includes a change to a JavaScript (.js) file is opened on a branch whose name starts with releases/:

on:
  pull_request_target:
    types:
      - opened
    branches:
      - 'releases/**'
    paths:
      - '**.js'

Running your pull_request_target workflow when a pull request merges

When a pull request merges, the pull request is automatically closed. To run a workflow when a pull request merges, use the pull_request_target closed event type along with a conditional that checks the merged value of the event. For example, the following workflow will run whenever a pull request closes. The if_merged job will only run if the pull request was also merged.

on:
  pull_request_target:
    types:
      - closed

jobs:
  if_merged:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
    - run: |
        echo The PR was merged

push

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
pushNot applicableTip commit pushed to the ref. When you delete a branch, the SHA in the workflow run (and its associated refs) reverts to the default branch of the repository.Updated ref

참고 항목

The webhook payload available to GitHub Actions does not include the added, removed, and modified attributes in the commit object. You can retrieve the full commit object using the API. For information, see 개체 in the GraphQL API documentation or 커밋에 대한 REST API 엔드포인트.

참고 항목

Events will not be created if more than 5,000 branches are pushed at once. Events will not be created for tags when more than three tags are pushed at once.

Runs your workflow when you push a commit or tag, or when you create a repository from a template.

For example, you can run a workflow when the push event occurs.

on:
  push

참고 항목

When a push webhook event triggers a workflow run, the Actions UI's "pushed by" field shows the account of the pusher and not the author or committer. However, if the changes are pushed to a repository using SSH authentication with a deploy key, then the "pushed by" field will be the repository admin who verified the deploy key when it was added it to a repository.

Running your workflow only when a push to specific branches occurs

You can use the branches or branches-ignore filter to configure your workflow to only run when specific branches are pushed. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when someone pushes to main or to a branch that starts with releases/.

on:
  push:
    branches:
      - 'main'
      - 'releases/**'

참고 항목

branches 필터와 paths 필터를 둘 다 사용하는 경우 두 필터가 모두 충족될 때만 워크플로가 실행됩니다. For example, the following workflow will only run when a push that includes a change to a JavaScript (.js) file is made to a branch whose name starts with releases/:

on:
  push:
    branches:
      - 'releases/**'
    paths:
      - '**.js'

Running your workflow only when a push of specific tags occurs

You can use the tags or tags-ignore filter to configure your workflow to only run when specific tags are pushed. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when someone pushes a tag that starts with v1..

on:
  push:
    tags:
      - v1.**

Running your workflow only when a push affects specific files

You can use the paths or paths-ignore filter to configure your workflow to run when a push to specific files occurs. For more information, see Workflow syntax for GitHub Actions.

For example, this workflow will run when someone pushes a change to a JavaScript file (.js):

on:
  push:
    paths:
      - '**.js'

registry_package

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
registry_package- published
- updated
Commit of the published packageBranch or tag of the published package

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

참고 항목

When pushing multi-architecture container images, this event occurs once per manifest, so you might observe your workflow triggering multiple times. To mitigate this, and only run your workflow job for the event that contains the actual image tag information, use a conditional:

jobs:
    job_name:
        if: $true

Runs your workflow when activity related to GitHub Packages occurs in your repository. For more information, see GitHub Packages Documentation.

For example, you can run a workflow when a new package version has been published.

on:
  registry_package:
    types: [published]

release

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
release- published
- unpublished
- created
- edited
- deleted
- prereleased
- released
Last commit in the tagged releaseTag ref of release refs/tags/<tag_name>

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

Workflows are not triggered for the created, edited, or deleted activity types for draft releases. When you create your release through the GitHub UI, your release may automatically be saved as a draft.

참고 항목

The prereleased type will not trigger for pre-releases published from draft releases, but the published type will trigger. If you want a workflow to run when stable and pre-releases publish, subscribe to published instead of released and prereleased.

Runs your workflow when release activity in your repository occurs. For information about the release APIs, see 개체 in the GraphQL API documentation or 릴리스 및 릴리스 자산에 대한 REST API 엔드포인트 in the REST API documentation.

For example, you can run a workflow when a release has been published.

on:
  release:
    types: [published]

repository_dispatch

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
repository_dispatchCustomLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

You can use the GitHub API to trigger a webhook event called repository_dispatch when you want to trigger a workflow for activity that happens outside of GitHub. For more information, see 리포지토리에 대한 REST API 엔드포인트.

When you make a request to create a repository_dispatch event, you must specify an event_type to describe the activity type. By default, all repository_dispatch activity types trigger a workflow to run. You can use the types keyword to limit your workflow to run when a specific event_type value is sent in the repository_dispatch webhook payload.

on:
  repository_dispatch:
    types: [test_result]

참고 항목

The event_type value is limited to 100 characters.

Any data that you send through the client_payload parameter will be available in the github.event context in your workflow. For example, if you send this request body when you create a repository dispatch event:

{
  "event_type": "test_result",
  "client_payload": {
    "passed": false,
    "message": "Error: timeout"
  }
}

then you can access the payload in a workflow like this:

on:
  repository_dispatch:
    types: [test_result]

jobs:
  run_if_failure:
    if: ${{ !github.event.client_payload.passed }}
    runs-on: ubuntu-latest
    steps:
      - env:
          MESSAGE: ${{ github.event.client_payload.message }}
        run: echo $MESSAGE

참고 항목

  • The maximum number of top-level properties in client_payload is 10.
  • The payload can contain a maximum of 65,535 characters.

schedule

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
Not applicableNot applicableLast commit on default branchDefault branch

참고 항목

  • GitHub Actions 워크플로가 실행되는 로드가 많은 기간 동안 schedule 이벤트가 지연될 수 있습니다. 높은 로드 시간에는 매 시간의 시작이 포함됩니다. 부하가 높으면 대기 중인 작업 일부가 삭제될 수 있습니다. 지연 가능성을 줄이려면 워크플로가 다른 시간에 실행되도록 예약합니다.

  • This event will only trigger a workflow run if the workflow file is on the default branch.

  • Scheduled workflows will only run on the default branch.

  • In a public repository, scheduled workflows are automatically disabled when no repository activity has occurred in 60 days. For information on re-enabling a disabled workflow, see Disabling and enabling a workflow.

  • For an enterprise with Enterprise Managed Users, scheduled workflows will not run if the last actor associated with the scheduled workflow has been deprovisioned (and therefore become suspended) by the Enterprise Managed User identity provider (IdP). However, if the last actor Enterprise Managed User has not been deprovisioned by the IdP, and has only been removed as a member from a given organization in the enterprise, scheduled workflows will still run with that user set as the actor. Similarly, for an enterprise without Enterprise Managed Users, removing a user from an organization will not prevent scheduled workflows which had that user as their actor from running. Essentially, triggering a scheduled workflow requires that the status of the actor user account associated with the workflow is currently active (i.e. not suspended or deleted). Thus, the user account's status, in both Enterprise Managed User and non-Enterprise Managed User scenarios, is what's important, not the user's membership status in the organization where the scheduled workflow is located.

  • Certain repository events change the actor associated with the workflow. For example, a user who changes the default branch of the repository, which changes the branch on which scheduled workflows run, becomes actor for those scheduled workflows.

  • For a deactivated scheduled workflow, if a user with write permissions to the repository makes a commit that changes the cron schedule on the workflow, the workflow will be reactivated, and that user will become the actor associated with any workflow runs. Note that, in this situation, the workflow is not reactivated by any change to the workflow file; you must alter the cron value in the workflow and commit this change.

    Example:

    on:
      schedule:
        - cron: "15 4,5 * * *"   # <=== Change this value
    

The schedule event allows you to trigger a workflow at a scheduled time.

POSIX cron 구문을 사용하여 특정 UTC 시간에 워크플로를 실행하도록 예약할 수 있습니다. 예약된 워크플로는 기본 분기 또는 베이스 분기의 최신 커밋에서 실행됩니다. 예약된 워크플로를 실행할 수 있는 가장 짧은 간격은 5분마다 한 번입니다.

이 예제에서는 매일 5:30 및 17:30 UTC에 워크플로를 트리거합니다.

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '30 5,17 * * *'

단일 워크플로는 여러 schedule 이벤트에 의해 트리거될 수 있습니다. github.event.schedule 컨텍스트를 통해 워크플로를 트리거한 일정 이벤트에 액세스할 수 있습니다. 이 예제에서는 매주 월~목요일 5:30 UTC에 실행되도록 워크플로를 트리거하지만 월요일과 수요일에는 Not on Monday or Wednesday 단계를 건너뜁니다.

on:
  schedule:
    - cron: '30 5 * * 1,3'
    - cron: '30 5 * * 2,4'

jobs:
  test_schedule:
    runs-on: ubuntu-latest
    steps:
      - name: Not on Monday or Wednesday
        if: github.event.schedule != '30 5 * * 1,3'
        run: echo "This step will be skipped on Monday and Wednesday"
      - name: Every time
        run: echo "This step will always run"

Cron syntax has five fields separated by a space, and each field represents a unit of time.

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
│ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
│ │ │ │ │
│ │ │ │ │
│ │ │ │ │
* * * * *

You can use these operators in any of the five fields:

OperatorDescriptionExample
*Any value15 * * * * runs at every minute 15 of every hour of every day.
,Value list separator2,10 4,5 * * * runs at minute 2 and 10 of the 4th and 5th hour of every day.
-Range of values30 4-6 * * * runs at minute 30 of the 4th, 5th, and 6th hour.
/Step values20/15 * * * * runs every 15 minutes starting from minute 20 through 59 (minutes 20, 35, and 50).

참고 항목

GitHub Actions does not support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly, and @reboot.

You can use crontab guru to help generate your cron syntax and confirm what time it will run. To help you get started, there is also a list of crontab guru examples.

Notifications for scheduled workflows are sent to the user who last modified the cron syntax in the workflow file. For more information, see 워크플로 실행에 대한 알림.

status

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
statusNot applicableLast commit on default branchDefault branch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when the status of a Git commit changes. For example, commits can be marked as error, failure, pending, or success. If you want to provide more details about the status change, you may want to use the check_run event. For information about the commit status APIs, see 개체 in the GraphQL API documentation or 커밋에 대한 REST API 엔드포인트.

For example, you can run a workflow when the status event occurs.

on:
  status

If you want to run a job in your workflow based on the new commit state, you can use the github.event.state context. For example, the following workflow triggers when a commit status changes, but the if_error_or_failure job only runs if the new commit state is error or failure.

on:
  status
jobs:
  if_error_or_failure:
    runs-on: ubuntu-latest
    if: >-
      github.event.state == 'error' ||
      github.event.state == 'failure'
    steps:
      - env:
          DESCRIPTION: ${{ github.event.description }}
        run: |
          echo The status is error or failed: $DESCRIPTION

watch

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
watch- startedLast commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. Although only the started activity type is supported, specifying the activity type will keep your workflow specific if more activity types are added in the future. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

Runs your workflow when the workflow's repository is starred. For information about the pull request APIs, see 변형 in the GraphQL API documentation or 별표 표시에 대한 REST API 엔드포인트.

For example, you can run a workflow when someone stars a repository, which is the started activity type for a watch event.

on:
  watch:
    types: [started]

workflow_call

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
Same as the caller workflowNot applicableSame as the caller workflowSame as the caller workflow

workflow_call is used to indicate that a workflow can be called by another workflow. When a workflow is triggered with the workflow_call event, the event payload in the called workflow is the same event payload from the calling workflow. For more information see, Reuse workflows.

The example below only runs the workflow when it's called from another workflow:

on: workflow_call

workflow_dispatch

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
workflow_dispatchNot applicableLast commit on the GITHUB_REF branch or tagBranch or tag that received dispatch

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

To enable a workflow to be triggered manually, you need to configure the workflow_dispatch event. You can manually trigger a workflow run using the GitHub API, GitHub CLI, or the GitHub UI. For more information, see Manually running a workflow.

on: workflow_dispatch

Providing inputs

You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. When you trigger the event, you can provide the ref and any inputs. When the workflow runs, you can access the input values in the inputs context. For more information, see Contexts reference.

참고 항목

  • 워크플로는 github.event.inputs 컨텍스트의 입력도 수신합니다. inputs 컨텍스트와 github.event.inputs 컨텍스트의 정보는 inputs 컨텍스트가 부울 값을 문자열로 변환하는 대신 부울 값으로 유지한다는 점을 제외하고 동일합니다. 이 choice 형식은 문자열로 확인되며 단일 선택 가능한 옵션입니다.
  • 최상위 속성 inputs의 최대 수는 10개입니다.
  • 최대 페이로드 inputs는 65,535자입니다.

This example defines inputs called logLevel, tags, and environment. You pass values for these inputs to the workflow when you run it. This workflow then prints the values to the log, using the inputs.logLevel, inputs.tags, and inputs.environment context properties.

on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'
        type: choice
        options:
        - info
        - warning
        - debug
      tags:
        description: 'Test scenario tags'
        required: false
        type: boolean
      environment:
        description: 'Environment to run tests against'
        type: environment
        required: true

jobs:
  log-the-inputs:
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Log level: $LEVEL"
          echo "Tags: $TAGS"
          echo "Environment: $ENVIRONMENT"
        env:
          LEVEL: ${{ inputs.logLevel }}
          TAGS: ${{ inputs.tags }}
          ENVIRONMENT: ${{ inputs.environment }}

If you run this workflow from a browser you must enter values for the required inputs manually before the workflow will run.

Screenshot of a list of workflow runs. A dropdown menu, labeled "Run workflow" and expanded to show input fields, is outlined in dark orange.

You can also pass inputs when you run a workflow from a script, or by using GitHub CLI. For example:

gh workflow run run-tests.yml -f logLevel=warning -f tags=false -f environment=staging

For more information, see the GitHub CLI information in Manually running a workflow.

workflow_run

Webhook event payloadActivity typesGITHUB_SHAGITHUB_REF
workflow_run- completed
- requested
- in_progress
Last commit on default branchDefault branch

참고 항목

둘 이상의 활동 유형이 이 이벤트를 트리거합니다. The requested activity type does not occur when a workflow is re-run. For information about each activity type, see 웹후크 이벤트 및 페이로드. 기본적으로 모든 활동 유형은 이 이벤트에서 실행되는 워크플로를 트리거합니다. types 키워드를 사용하여 워크플로 실행을 특정 활동 유형으로 제한할 수 있습니다. 자세한 내용은 Workflow syntax for GitHub Actions을(를) 참조하세요.

참고 항목

이 이벤트는 워크플로 파일이 기본 분기에 있는 경우에만 워크플로 실행을 트리거합니다.

참고 항목

You can't use workflow_run to chain together more than three levels of workflows. For example, if you attempt to trigger five workflows (named B to F) to run sequentially after an initial workflow A has run (that is: ABCDEF), workflows E and F will not be run.

This event occurs when a workflow run is requested or completed. It allows you to execute a workflow based on execution or completion of another workflow. The workflow started by the workflow_run event is able to access secrets and write tokens, even if the previous workflow was not. This is useful in cases where the previous workflow is intentionally not privileged, but you need to take a privileged action in a later workflow.

In this example, a workflow is configured to run after the separate "Run Tests" workflow completes.

on:
  workflow_run:
    workflows: [Run Tests]
    types:
      - completed

If you specify multiple workflows for the workflow_run event, only one of the workflows needs to run. For example, a workflow with the following trigger will run whenever the "Staging" workflow or the "Lab" workflow completes.

on:
  workflow_run:
    workflows: [Staging, Lab]
    types:
      - completed

Running a workflow based on the conclusion of another workflow

A workflow run is triggered regardless of the conclusion of the previous workflow. If you want to run a job or step based on the result of the triggering workflow, you can use a conditional with the github.event.workflow_run.conclusion property. For example, this workflow will run whenever a workflow named "Build" completes, but the on-success job will only run if the "Build" workflow succeeded, and the on-failure job will only run if the "Build" workflow failed:

on:
  workflow_run:
    workflows: [Build]
    types: [completed]

jobs:
  on-success:
    runs-on: ubuntu-latest
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    steps:
      - run: echo 'The triggering workflow passed'
  on-failure:
    runs-on: ubuntu-latest
    if: ${{ github.event.workflow_run.conclusion == 'failure' }}
    steps:
      - run: echo 'The triggering workflow failed'

Limiting your workflow to run based on branches

You can use the branches or branches-ignore filter to specify what branches the triggering workflow must run on in order to trigger your workflow. For more information, see Workflow syntax for GitHub Actions. For example, a workflow with the following trigger will only run when the workflow named Build runs on a branch named canary.

on:
  workflow_run:
    workflows: [Build]
    types: [requested]
    branches: [canary]

Using data from the triggering workflow

You can access the workflow_run event payload that corresponds to the workflow that triggered your workflow. For example, if your triggering workflow generates artifacts, a workflow triggered with the workflow_run event can access these artifacts.

The following workflow uploads data as an artifact. (In this simplified example, the data is the pull request number.)

name: Upload data

on:
  pull_request:

jobs:
  upload:
    runs-on: ubuntu-latest

    steps:
      - name: Save PR number
        env:
          PR_NUMBER: ${{ github.event.number }}
        run: |
          mkdir -p ./pr
          echo $PR_NUMBER > ./pr/pr_number
      - uses: actions/upload-artifact@v4
        with:
          name: pr_number
          path: pr/

When a run of the above workflow completes, it triggers a run of the following workflow. The following workflow uses the github.event.workflow_run context and the GitHub REST API to download the artifact that was uploaded by the above workflow, unzips the downloaded artifact, and comments on the pull request whose number was uploaded as an artifact.

name: Use the data

on:
  workflow_run:
    workflows: [Upload data]
    types:
      - completed

jobs:
  download:
    runs-on: ubuntu-latest
    steps:
      - name: 'Download artifact'
        uses: actions/github-script@v7
        with:
          script: |
            let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
               owner: context.repo.owner,
               repo: context.repo.repo,
               run_id: context.payload.workflow_run.id,
            });
            let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
              return artifact.name == "pr_number"
            })[0];
            let download = await github.rest.actions.downloadArtifact({
               owner: context.repo.owner,
               repo: context.repo.repo,
               artifact_id: matchArtifact.id,
               archive_format: 'zip',
            });
            const fs = require('fs');
            const path = require('path');
            const temp = '${{ runner.temp }}/artifacts';
            if (!fs.existsSync(temp)){
              fs.mkdirSync(temp);
            }
            fs.writeFileSync(path.join(temp, 'pr_number.zip'), Buffer.from(download.data));

      - name: 'Unzip artifact'
        run: unzip pr_number.zip -d "${{ runner.temp }}/artifacts"

      - name: 'Comment on PR'
        uses: actions/github-script@v7
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const fs = require('fs');
            const path = require('path');
            const temp = '${{ runner.temp }}/artifacts';
            const issue_number = Number(fs.readFileSync(path.join(temp, 'pr_number')));
            await github.rest.issues.createComment({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: issue_number,
              body: 'Thank you for the PR!'
            });