2020/09/04

Github Actions

HEAD~n

Github Actions์—์„œ actions/checkout@v2๋Š” ์ตœ๊ทผ 1๊ฐœ์˜ ํžˆ์Šคํ† ๋ฆฌ๋งŒ ๊ฐ€์ ธ์˜จ๋‹ค. ๊ทธ๋ž˜์„œ HEAD~1 ๋“ฑ์„ ํ•˜๋ฉด ํ•ด๋‹น ๋ฆฌ๋น„์ „(revision)์„ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๊ณ  ๋‚˜์˜จ๋‹ค.

์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” fetch-depth ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•ด์•ผํ•œ๋‹ค. #

- 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๋กœ๋งŒ ์‹คํ–‰ ์‹œ ์‹คํŒจ์ธ ๊ฒƒ์„ ์ฐธ๊ณ )

Last updated