Git Actions Notes
Git Action으로 ‘cluster add approve’ 라는 코멘트를 남길 시 workflow가 작동하게 해보기.
# 코멘트가 ok! 일때만 동작하게 하기. 경로는 repo .github/workflows/[workflow이름].yaml
name: CI-Test2
# Controls when the workflow will run
on:
issue_comment:
types: [created]
jobs:
vars-read:
if: contains(github.event.comment.body, 'ok!')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Read file content
run: |
test1=`ls -ltr /home/runner/work/GitAction-Test/GitAction-Test/ | tail -1 | awk '{print $9}'`
echo $test1
Skip Action
Success Action
테스트를 통해 확인 된 바로는 issue_comment를 통해 close 된 issue에 코멘트를 달아도 동작한다.이거는 해결 방법이 있는지 확인해봐야겠다.
issue opend를 같이 사용하면 될 것 같기도..?
* 특정 path에 push event를 지정하고 if: contains(github.event.comment.body, 'ok!') 로 제어 가능함.
dispatch repository (to run a workflow using curl command manually [API])
참조:
https://stackoverflow.com/questions/71014373/combine-multiple-triggers-with-multiple-branches
https://medium.com/@hongseongho/github-action으로-comment-bot-만들기-422e6e471c8e
Special thanks to tnrms007