{"meta":{"title":"워크플로에 스크립트 추가","intro":"워크플로를 사용하여 GitHub Actions 스크립트를 실행할 수 있습니다.","product":"GitHub Actions","breadcrumbs":[{"href":"/ko/actions","title":"GitHub Actions"},{"href":"/ko/actions/how-tos","title":"사용법"},{"href":"/ko/actions/how-tos/write-workflows","title":"워크플로 작성"},{"href":"/ko/actions/how-tos/write-workflows/choose-what-workflows-do","title":"워크플로에서 수행하는 작업 선택"},{"href":"/ko/actions/how-tos/write-workflows/choose-what-workflows-do/add-scripts","title":"스크립트 추가"}],"documentType":"article"},"body":"# 워크플로에 스크립트 추가\n\n워크플로를 사용하여 GitHub Actions 스크립트를 실행할 수 있습니다.\n\n워크플로를 GitHub Actions 사용하여 스크립트 및 셸 명령을 실행한 다음 할당된 실행기에서 실행할 수 있습니다. 이 예제에서는 `run` 키워드를 사용하여 러너에서 `npm install -g bats` 명령을 실행하는 방법을 보여줍니다.\n\n```yaml\njobs:\n  example-job:\n    runs-on: ubuntu-latest\n    steps:\n      - run: npm install -g bats\n```\n\n워크플로를 사용하여 리포지토리에 저장된 스크립트를 실행하려면 먼저 리포지토리를 runner로 체크아웃해야 합니다. 이렇게 하면 `run` 키워드를 사용하여 실행기에서 스크립트를 실행할 수 있습니다. 다음 예제에서는 각각 별도의 작업 단계에서 두 개의 스크립트를 실행합니다. 실행기에서 스크립트의 위치는 실행 명령에 대한 기본 작업 디렉터리를 설정하여 지정됩니다. 자세한 내용은 [기본 셸 및 작업 디렉터리 설정](/ko/actions/how-tos/write-workflows/choose-what-workflows-do/set-default-values-for-jobs)을(를) 참조하세요.\n\n```yaml\njobs:\n  example-job:\n    runs-on: ubuntu-latest\n    defaults:\n      run:\n        working-directory: ./scripts\n    steps:\n      - name: Check out the repository to the runner\n        uses: actions/checkout@v6\n      - name: Run a script\n        run: ./my-script.sh\n      - name: Run another script\n        run: ./my-other-script.sh\n```\n\n워크플로 작업을 실행하려는 모든 스크립트는 실행 가능해야 합니다. 스크립트를 실행할 인터프리터에 인수로 스크립트를 전달하거나(예: `run: bash script.sh`) 파일 자체를 실행 가능하게 하여 워크플로 내에서 이 작업을 수행할 수 있습니다. 로컬에서 `git update-index --chmod=+x PATH/TO/YOUR/script.sh` 명령을 사용한 다음 파일을 커밋하고 리포지토리에 푸시하여 파일에 실행 권한을 부여할 수 있습니다. 또는 Linux 및 Mac 실행기에서 실행되는 워크플로의 경우 스크립트를 실행하기 전에 워크플로 작업에서 실행 권한을 파일에 부여하는 명령을 추가할 수 있습니다.\n\n```yaml\njobs:\n  example-job:\n    runs-on: ubuntu-latest\n    defaults:\n      run:\n        working-directory: ./scripts\n    steps:\n      - name: Check out the repository to the runner\n        uses: actions/checkout@v6\n      - name: Make the script files executable\n        run: chmod +x my-script.sh my-other-script.sh\n      - name: Run the scripts\n        run: |\n          ./my-script.sh\n          ./my-other-script.sh\n```\n\n`run` 키워드에 대한 자세한 내용은 [GitHub Actions에 대한 워크플로 구문](/ko/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsrun)을(를) 참조하세요."}