인증 및 커밋을 github actions bot 으로 하고싶을 때 아래와 같이 설정하면 된다.

git config 설정

코드로 설정

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"

credential 설정

참고로 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}`
);
profile
JavaScript, TypeScript and React-Native

0개의 댓글

Powered by GraphCDN, the GraphQL CDN