Created
October 24, 2019 17:09
-
-
Save lobrien/a9f029db1af36184d86605638075667f to your computer and use it in GitHub Desktop.
Inline Python Action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: push | |
name: Inline Python Action | |
jobs: | |
my-job: | |
name: My job | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Inline python step | |
run: | | |
import os | |
import json | |
import urllib | |
def readJson(path) : | |
with open(path) as json_file: | |
data = json.load(json_file) | |
return data | |
print(os.environ['PATH']) | |
for f in os.listdir("."): | |
print(f) | |
path = os.environ['GITHUB_EVENT_PATH'] | |
print('Event path is %s' % path) | |
event = readJson(path) | |
print(json.dumps(event,indent=2)) | |
url = event['head_commit']['url'] | |
print('HEAD is at %s' % url) | |
shell: python | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment