GITHUB_EVENT_PATH로 event.json 파싱하기

gzip·2023년 5월 21일

TypeScript에서 GITHUB_EVENT_PATH로 event.json 파싱하기

private parseEvent(): any {
	const githubEventPath: string = process.env['GITHUB_EVENT_PATH'] as string
    return JSON.parse(fs.readFileSync(githubEventPath, 'utf-8'))
}

GitHub Actions로 확인하기

name: Dump
on:
  push:

jobs:
  dump:
    name: npm Build
    runs-on: ubuntu-latest

    steps:
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: |
          echo "$GITHUB_CONTEXT"

https://docs.github.com/ko/actions/learn-github-actions/variables#default-environment-variables
https://github.com/actions/checkout/issues/58

0개의 댓글