> For the complete documentation index, see [llms.txt](https://devlog.joonas.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devlog.joonas.io/logs-etc/04-github-actions.md).

# 2020/09/04

## Github Actions

### HEAD\~n

Github Actions에서 `actions/checkout@v2`는 최근 1개의 히스토리만 가져온다. 그래서 `HEAD~1` 등을 하면 해당 리비전(revision)을 찾을 수 없다고 나온다.

이를 해결하기 위해서는 `fetch-depth` 옵션을 추가해야한다. [#](https://github.com/actions/checkout#checkout-head)

```
- uses: actions/checkout@v2
  with:
    fetch-depth: 2
- run: git checkout HEAD^
```

### Error with exit code 1.

분명 문제 없이 프로세스를 끝냈지만, 아무 로그도 없이 빌드에 실패했다고 나오는 경우가 있다.

yml 파일과 그 결과는 이랬다.

```
- run: MSG=`git diff HEAD HEAD~1 --name-only | egrep [0-9]+\/`
```

```
##[error]Process completed with exit code 1.
```

이것과 관련해서는 아래 링크로 해결할 수 있다.

<https://github.com/actions/virtual-environments/issues/1279#issuecomment-663462004>

3가지 케이스로 실험했는데 결과는 다음과 같다.

1. `./test.sh`로 실행 (성공)
2. `source ./test.sh`로 실행 **(실패)**
3. `source ./test.sh || true`로 실행 **(성공)**

이 사례로 보아, 쉘에서 스크립트를 직접 실행하면 exit code가 0이 아닌 것으로 보인다. (`source`로만 실행 시 실패인 것을 참고)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devlog.joonas.io/logs-etc/04-github-actions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
