Skip to content

Instantly share code, notes, and snippets.

@lobrien
Created October 24, 2019 17:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lobrien/a9f029db1af36184d86605638075667f to your computer and use it in GitHub Desktop.
Save lobrien/a9f029db1af36184d86605638075667f to your computer and use it in GitHub Desktop.
Inline Python Action
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