인증 및 커밋을 github actions bot 으로 하고싶을 때 아래와 같이 설정하면 된다.
import { exec } from "@actions/exec";
await exec("git", [
"config",
"user.name",
`"github-actions[bot]"`,
]);
await exec("git", [
"config",
"user.email",
`"github-actions[bot]@users.noreply.github.com"`,
]);
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
참고로 github token 은 secrets 에 기본으로 포함돼있다.
https://docs.github.com/ko/actions/security-guides/automatic-token-authentication
await fs.writeFile(
`${process.env.HOME}/.netrc`,
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
);