오픈소스 프로젝트 만들어보기
오픈소스 프로젝트 주제 선정
가장 좋은 오픈소스는 개발 과정에 필요성을 해소하는 주제
주제가 없다면
- 복잡한 구동과정 없이 결과를 확인할 수 있음
- 확장성이 있는 기능
- lodash.js
- underscore.js
- immer.js
소스코드 작업
- npm 패키지 셋팅
npm init -y
PR 관리를 위한 github action 설정
github actions 란?
- GitHub에서 제공하는 빌드, 테스트 및 배포 파이프라인을 자동화할 수 있는 CI/CD 서비스
- CI(Continuous Integration, 지속 통합)와 CD(Continuous Deployment, 지속 배포)
- .github/workflows 폴더에 yml 파일로 정의
name: Pull Request Check # 워크플로우 이름
on: # 워크플로우 실행 트리거
pull_request: # pull_request가 실행될 때만
types: [opened, synchronize] # PR이 생성되거나 업데이트 될 때
jobs: # 작업 정의
check:
runs-on: ubuntu-latest # 우분투 환경
permissions: # 권한 설정
pull-requests: write # PR에 쓰기 권한 설정
issues: write
steps: # 작업 단계
- uses: actions/github-script@v7
with:
script: | # 스크립트 시작
async function run() {
const pull_request = context.payload.pull_request; // pull_request 객체 가져오기
if(pull_request === undefined) { // pull_request가 없는 경우
console.log("This is not a pull request"); // "This is not a pull request" 출력
return; // 종료
}
const body = pull_request.body; // 본문 담기
const message = "아래 기입 내용을 작성해주시고 해당 라인을 삭제해주세요"
if(!body || body.includes(message)){
try {
// PR에 코멘트를 추가합니다.
await github.rest.issues.createComment({ // PR에 코멘트 추가
owner: context.repo.owner, // 저장소 소유자
repo: context.repo.repo, // 저장소 이름
issue_number: pull_request.number, // PR 번호
body: "해당 PR은 가이드라인을 준수하지 않았습니다.", // 코멘트 내용
});
// PR을 닫습니다.
await github.rest.pulls.update({ // PR을 닫음
owner: context.repo.owner, // 저장소 소유자
repo: context.repo.repo, // 저장소 이름
pull_number: pull_request.number, // PR 번호
state: "closed", // 상태를 닫힘으로 변경
});
} catch (error) {
console.error("Error occurred while closing PR:", error); // 오류 메세지 출력
}
}
};
run();'개발지식 > 오픈소스' 카테고리의 다른 글
| 260108 오픈소스 배포하기 (0) | 2026.01.07 |
|---|---|
| 260105 오픈소스 first contributions 프로젝트 기여 (0) | 2026.01.05 |
| 1224 github 문서 템플릿 / 모던 자바스크립트 튜토리얼 기여 (0) | 2025.12.24 |
| 1223 MDN Web Docs 기여 실습 (0) | 2025.12.23 |
| 1212 오픈 소스 사용 체크리스트 (0) | 2025.12.12 |