Skip to main content

Using workflow run logs

You can view, search, and download the logs for each job in a workflow run.

You can see whether a workflow run is in progress or complete from the workflow run page. You must be logged in to a GitHub account to view workflow run information, including for public repositories. For more information, see "GitHub의 액세스 권한."

If the run is complete, you can see whether the result was a success, failure, canceled, or neutral. If the run failed, you can view and search the build logs to diagnose the failure and re-run the workflow. You can also view billable job execution minutes, or download logs and build artifacts.

GitHub Actions use the Checks API to output statuses, results, and logs for a workflow. GitHub creates a new check suite for each workflow run. The check suite contains a check run for each job in the workflow, and each job includes steps. GitHub Actions are run as a step in a workflow. For more information about the Checks API, see "검사에 대한 REST API 엔드포인트."

참고: 리포지토리에 유효한 워크플로 파일만 커밋해야 합니다. .github/workflows에 잘못된 워크플로 파일이 포함된 경우 GitHub Actions는 모든 새 커밋에 대해 실패한 워크플로 실행을 생성합니다.

Viewing logs to diagnose failures

If your workflow run fails, you can see which step caused the failure and review the failed step's build logs to troubleshoot. You can see the time it took for each step to run. You can also copy a permalink to a specific line in the log file to share with your team. 해당 단계를 수행하려면 리포지토리에 대한 읽기 권한이 필요합니다.

In addition to the steps configured in the workflow file, GitHub adds two additional steps to each job to set up and complete the job's execution. These steps are logged in the workflow run with the names "Set up job" and "Complete job".

For jobs run on GitHub-hosted runners, "Set up job" records details of the runner image, and includes a link to the list of preinstalled tools that were present on the runner machine.

  1. GitHub.com에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 작업을 클릭합니다.

    "github/docs" 리포지토리의 탭 스크린샷. "작업" 탭은 주황색 윤곽선으로 강조 표시됩니다.

  3. 왼쪽 사이드바에서 확인할 워크플로를 클릭합니다.

    "작업" 탭의 왼쪽 사이드바 스크린샷. "CodeQL"이라는 워크플로가 진한 주황색 윤곽선으로 표시되어 있습니다.

  4. 워크플로 실행 목록에서 실행 이름을 클릭하여 워크플로 실행 요약을 확인합니다.

  5. 작업 또는 시각화 그래프에서 확인할 작업을 클릭합니다.

  6. 실패한 단계는 결과를 표시하도록 자동으로 확장됩니다.

  7. 필요에 따라 로그의 특정 줄에 대한 링크를 얻으려면 단계의 줄 번호를 클릭합니다. 그런 다음 웹 브라우저의 주소 표시줄에서 링크를 복사할 수 있습니다.

    작업의 로그를 보여주는 스크린샷. 실패한 단계 로그가 확장되고 줄 번호가 주황색 윤곽선으로 강조 표시됩니다.

Searching logs

You can search the build logs for a particular step. When you search logs, only expanded steps are included in the results. 해당 단계를 수행하려면 리포지토리에 대한 읽기 권한이 필요합니다.

  1. GitHub.com에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 작업을 클릭합니다.

    "github/docs" 리포지토리의 탭 스크린샷. "작업" 탭은 주황색 윤곽선으로 강조 표시됩니다.

  3. 왼쪽 사이드바에서 확인할 워크플로를 클릭합니다.

    "작업" 탭의 왼쪽 사이드바 스크린샷. "CodeQL"이라는 워크플로가 진한 주황색 윤곽선으로 표시되어 있습니다.

  4. 워크플로 실행 목록에서 실행 이름을 클릭하여 워크플로 실행 요약을 확인합니다.

  5. 작업 또는 시각화 그래프에서 확인할 작업을 클릭합니다.

  6. In the upper-right corner of the log output, in the Search logs search box, type a search query.

Downloading logs

You can download the log files from your workflow run. You can also download a workflow's artifacts. For more information, see "워크플로 데이터를 아티팩트로 저장." 해당 단계를 수행하려면 리포지토리에 대한 읽기 권한이 필요합니다.

  1. GitHub.com에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 작업을 클릭합니다.

    "github/docs" 리포지토리의 탭 스크린샷. "작업" 탭은 주황색 윤곽선으로 강조 표시됩니다.

  3. 왼쪽 사이드바에서 확인할 워크플로를 클릭합니다.

    "작업" 탭의 왼쪽 사이드바 스크린샷. "CodeQL"이라는 워크플로가 진한 주황색 윤곽선으로 표시되어 있습니다.

  4. 워크플로 실행 목록에서 실행 이름을 클릭하여 워크플로 실행 요약을 확인합니다.

  5. 작업 또는 시각화 그래프에서 확인할 작업을 클릭합니다.

  6. In the upper right corner of the log, select the dropdown menu, then click Download log archive.

    Screenshot of the log for a job. In the header, a gear icon is outlined in dark orange.

Note: When you download the log archive for a workflow that was partially re-run, the archive only includes the jobs that were re-run. To get a complete set of logs for jobs that were run from a workflow, you must download the log archives for the previous run attempts that ran the other jobs.

Deleting logs

You can delete the log files from your workflow runs through the GitHub web interface or programmatically. 해당 단계를 수행하려면 리포지토리에 대한 쓰기 권한이 필요합니다.

Deleting logs via the GitHub web interface

  1. GitHub.com에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 작업을 클릭합니다.

    "github/docs" 리포지토리의 탭 스크린샷. "작업" 탭은 주황색 윤곽선으로 강조 표시됩니다.

  3. 왼쪽 사이드바에서 확인할 워크플로를 클릭합니다.

    "작업" 탭의 왼쪽 사이드바 스크린샷. "CodeQL"이라는 워크플로가 진한 주황색 윤곽선으로 표시되어 있습니다.

  4. 워크플로 실행 목록에서 실행 이름을 클릭하여 워크플로 실행 요약을 확인합니다.

  5. In the upper-right corner, select the dropdown menu, then click Delete all logs.

    Screenshot of the page for a workflow run. In the top-right corner, a button, labeled with a kebab icon, is outlined in dark orange.

  6. Review the confirmation prompt.

After deleting logs, the Delete all logs button is removed to indicate that no log files remain in the workflow run.

Deleting logs programmatically

You can use the following script to automatically delete all logs for a workflow. This can be a useful way to clean up logs for multiple workflow runs.

To run the example script below:

  1. Copy the code example and save it to a file called delete-logs.sh.

  2. Grant it the execute permission with chmod +x delete-logs.sh.

  3. Run the following command, where REPOSITORY_NAME is the name of your repository and WORKFLOW_NAME is the file name of your workflow.

    Shell
    ./delete-logs.sh REPOSITORY_NAME WORKFLOW_NAME
    

    For example, to delete all of the logs in the monalisa/octocat repository for the .github/workflows/ci.yaml workflow, you would run ./delete-logs.sh monalisa/octocat ci.yaml.

Example script

Bash
#!/usr/bin/env bash

# Delete all logs for a given workflow
# Usage: delete-logs.sh <repository> <workflow-name>

set -oe pipefail

REPOSITORY=$1
WORKFLOW_NAME=$2

# Validate arguments
if [[ -z "$REPOSITORY" ]]; then
  echo "Repository is required"
  exit 1
fi

if [[ -z "$WORKFLOW_NAME" ]]; then
  echo "Workflow name is required"
  exit 1
fi

echo "Getting all completed runs for workflow $WORKFLOW_NAME in $REPOSITORY"

RUNS=$(
  gh api \
    -H "Accept: application/vnd.github+json" \
    -H "X-GitHub-Api-Version: 2022-11-28" \
    "/repos/$REPOSITORY/actions/workflows/$WORKFLOW_NAME/runs" \
    --paginate \
    --jq '.workflow_runs[] | select(.conclusion != "") | .id'
)

echo "Found $(echo "$RUNS" | wc -l) completed runs for workflow $WORKFLOW_NAME"

# Delete logs for each run
for RUN in $RUNS; do
  echo "Deleting logs for run $RUN"
  gh api \
    --silent \
    --method DELETE \
    -H "Accept: application/vnd.github+json" \
    -H "X-GitHub-Api-Version: 2022-11-28" \
    "/repos/$REPOSITORY/actions/runs/$RUN/logs" || echo "Failed to delete logs for run $RUN"

  # Sleep for 100ms to avoid rate limiting
  sleep 0.1
done

Viewing logs with GitHub CLI

Dependabot alerts의 자세한 내용은 “GitHub CLI 정보”를 참조하세요.

To view the log for a specific job, use the run view subcommand. Replace run-id with the ID of run that you want to view logs for. GitHub CLI returns an interactive menu for you to choose a job from the run. If you don't specify run-id, GitHub CLI returns an interactive menu for you to choose a recent run, and then returns another interactive menu for you to choose a job from the run.

gh run view RUN_ID --log

You can also use the --job flag to specify a job ID. Replace job-id with the ID of the job that you want to view logs for.

gh run view --job JOB_ID --log

You can use grep to search the log. For example, this command will return all log entries that contain the word error.

gh run view --job JOB_ID --log | grep error

To filter the logs for any failed steps, use --log-failed instead of --log.

gh run view --job JOB_ID --log-failed