diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml deleted file mode 100644 index f40ffbc..0000000 --- a/.github/workflows/blank.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: CI - -on: [issue_comment] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: print event data - shell: python - run: | - import json, os, pprint - event_path = os.environ['GITHUB_EVENT_PATH'] - event_data = json.load(open(event_path)) - pprint.pprint(event_data) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e1903e0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: test suite +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python: [2.7, 3.6, 3.7, 3.8] + fail-fast: false + steps: + - uses: actions/checkout@v1 + - name: set up Python + uses: actions/setup-python@v1 + with: + python-version: ${{matrix.python}} + - name: run tests + run: | + pip install pytest + pytest -v test.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d8e15fc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: test +on: + check_suite: + types: [completed] + issue_comment: + types: [created] + issues: + types: [milestoned] + pull_request: + types: [labeled] +jobs: + react-to-comment: + runs-on: ubuntu-latest + steps: + - name: install dependencies + run: | + pip install PyGithub + pip install git+https://github.com/boegel/py-github-actions.git + - name: react to comment + shell: python + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + from actions.event import get_event_data, triggered_by + from actions.issues import * + + # print event data (just for debugging purposes) + event_data = get_event_data(verbose=True) + + print('comments:\n' + '\n'.join(get_issue_comments())) + print('labels: ' + ', '.join(get_label_names())) + print('milestone: %s' % get_milestone_title()) + if pr_context(): + print('PR status: ' + get_pr_status()) + + if triggered_by('issue_comment'): + reply_txt = "@%(sender_login)s: Thank you for your comment '%(comment_body)s'!" + post_comment(reply_txt) diff --git a/README.md b/README.md index f8d86a1..af1a7dd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # test-github-actions Testing GitHub Actions... + +This is just a test diff --git a/test.py b/test.py new file mode 100644 index 0000000..24e6f64 --- /dev/null +++ b/test.py @@ -0,0 +1,6 @@ +import time + +def test(): + for i in range(30): + assert(i == i) + time.sleep(1)