안됨

git은 기본적으로 main branch에 대해서만 추적

그래서 git actions 를 사용해서 머지가 됐을 때 issue를 자동으로 닫아줘야 함

현재 브랜치 가져오는 방법들

const branch = process.env.GITHUB_HEAD_REF
const branch = require(process.env.GITHUB_EVENT_PATH).pull_request.head.ref;

// 아래는 pr event 발생시에만 가능한 방법
const pr = await github.rest.pulls.get({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: context.payload.pull_request.number
            });
const barnch = pr.data.head.ref;

// 아래는 pr event 발생시에만 가능한 방법
const branch = context.payload.pull_request.head.ref

github rest api 사용

아래 사이트를 참조해서 사용하면 됨

ex) octokit.rest.pulls.checkIfMerged 일 경우

octokit/rest.js

git action context

js에서 사용할 때는 process.env.GITHUB_HEAD_REF 로 사용하면 됨

es) context가 github.event_path인 경우

Contexts - GitHub Docs