Skip to content

Commit

Permalink
Test local action to add jobs (#1)
Browse files Browse the repository at this point in the history
* adding a job back
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Oct 23, 2021
1 parent 577e36c commit 13a395a
Show file tree
Hide file tree
Showing 7 changed files with 263 additions and 163 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/post-jobs-slack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
pull_request:
paths:
- 'example/jobs.yaml'
branches:
- main

jobs:
slack-poster:
runs-on: ubuntu-latest
name: Run Jobs Slack Poster
steps:
- uses: actions/checkout@v2
- id: updater
name: Job Updater
uses: ./
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
with:
filename: "example/jobs.yaml"
key: "url"

- run: echo ${{ steps.updater.outputs.fields }}
name: Show New Jobs
shell: bash
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ and a yaml file with a list of jobs (or other links):
url: https://my-job.org/12345
```

The action will inspect the file to determine lines that are newly added,
given a field of interest, extract this field, and then post to a Slack channel.
The action will inspect the file to determine lines that are newly added (compared to the main branch)
for a field of interest (e.g., the "url" attribute in a list of jobs), extract this field, and then post to a Slack channel.

![img/example.png](img/example.png)

This is custom made to help the [US-RSE](https://github.com/US-RSE/usrse.github.io) site
to have job updates posted to slack!

## Quickstart

1. Create a [webhook app](https://api.slack.com/messaging/webhooks#getting_started) and grab the URL and save to `SLACK_WEBHOOK` in your repository secrets.
2. Add a GitHub workflow file, as shown below, with your desired triggers.

For more details on the above, keep reading.

## 1. Slack Setup

Expand All @@ -32,43 +44,36 @@ and put it in a safe place. We will want to keep this URL as a secret in our eve

## 2. Usage

Add an GitHub workflow file in .github/workflows to specify the following:
Add an GitHub workflow file in .github/workflows to specify the following. Note that
the workflow below will do the check and update on the opening of a pull request.

```yaml
on:
- pull_request: []
pull_request:
paths:
- '_data/jobs.yml'
types:
- opened
branches:
- main

jobs:
slack-poster:
runs-on: ubuntu-latest
name: Run Jobs Slack Poster
steps:
- uses: actions/checkout@v2

- id: changed-files
uses: jitterbit/get-changed-files@d06c756e3609dd3dd5d302dde8d1339af3f790f2
- name: Check if Jobs Updated
id: checker
run: |
echo "::set-output name=jobs_updated::false"
for changed_file in ${{ steps.files.outputs.added_modified }}; do
printf "Checking changed file ${changed_file}\n"
if [[ "${changed_file}" == "_data/jobs.yml" ]]; then
printf "Found changed jobs!\n"
echo "::set-output name=jobs_updated::true"
fi
done
- id: updater
if: ${{ steps.checker.outputs.jobs_updated == "true" }}
uses: ./
name: Job Updater
uses: rseng/jobs-updater@main
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
with:
filename: "examples/jobs.yaml"
filename: "_data/jobs.yml"
key: "url"

- run: echo ${{ steps.updater.outputs.fields }}
name: Show New Jobs
shell: bash
```

36 changes: 36 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Jobs Updater'
description: "The jobs updater will respond on some trigger, and them parse a jobs file for changes, posting a field of interest to slack."
inputs:
main:
description: main branch to compare to (defaults to main)
required: false
default: main
filename:
description: the filename for the jobs
required: true
key:
description: The key of the list to post (defaults to url)
required: false
default: url

outputs:
fields:
description: New fields parsed

runs:
using: "composite"
steps:
- name: Install Python Dependencies
run: pip install pyyaml requests
shell: bash

- name: Run action entrypoint
id: jobs-updater
env:
INPUT_FILENAME: ${{ inputs.filename }}
INPUT_MAIN: ${{ inputs.main }}
INPUT_KEY: ${{ inputs.key }}
ACTION_DIR: ${{ github.action_path }}
INPUT_REPO: ${{ github.repository }}
run: ${{ github.action_path }}/entrypoint.sh
shell: bash
42 changes: 42 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -e

echo $PWD
ls

# Ensure the jobfile exists
if [[ ! -f "${INPUT_FILENAME}" ]]; then
printf "${INPUT_FILENAME} does not exist.\n"
exit 1
fi

# Wget the comparison file
JOBFILE="https://raw.githubusercontent.com/${INPUT_REPO}/${INPUT_MAIN}/${INPUT_FILENAME}"
TMP=$(mktemp -d)

BASENAME=$(basename ${INPUT_FILENAME})
wget ${JOBFILE} -O "${TMP}/${BASENAME}"
if [[ "$?" != "0" ]]; then
printf "Issue getting previous job file ${JOBFILE}\n"
exit 1
fi

JOBFILE="${TMP}/${BASENAME}"
if [[ ! -f "${JOBFILE}" ]]; then
printf "${JOBFILE} does not exist.\n"
exit 1
fi

# Required to have slack webhook in environment
if [ -z ${SLACK_WEBHOOK+x} ]; then
printf "Please export SLACK_WEBHOOK to use this integration\n"
exit 1
fi

COMMAND="python ${ACTION_DIR}/find-updates.py update --key ${INPUT_KEY} --original ${JOBFILE} --updated ${INPUT_FILENAME}"

echo "${COMMAND}"

${COMMAND}
echo $?
149 changes: 8 additions & 141 deletions example/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
location: University of Michigan, Ann Arbor, Michigan
name: Research Software Programmer
url: https://careers.umich.edu/job_detail/204649/research_software_programmer_-_mobile_python
- expires: 2021-12-10
location: University of Washington, Seattle, WA
name: Research Software Engineer
url: https://uw-echospace.github.io/position/2021-09-06-rse/
- expires: 2021-10-31
location: Princeton University, Princeton, NJ
name: Research Software Engineer
Expand All @@ -14,145 +10,16 @@
location: Scoot Science - remote in the US or Canada
name: Data Engineer & Full Stack Software Engineer
url: https://www.scootscience.com/careers/
- expires: 2021-09-30
location: 'Rand Corporation: Santa Monica, CA; Pittsburgh, PA; Boston, MA; Washington,
DC'
name: Research Software Engineer (Level One)
url: https://rand.wd5.myworkdayjobs.com/en-US/External_Career_Site/job/Santa-Monica-CA-Greater-Los-Angeles-Area/Research-Software-Engineer--Level-One-_R695
- expires: 2021-09-30
location: 'Rand Corporation: Santa Monica, CA; Pittsburgh, PA; Boston, MA; Washington,
DC'
name: Research Software Engineer
url: https://rand.wd5.myworkdayjobs.com/en-US/External_Career_Site/job/Santa-Monica-CA-Greater-Los-Angeles-Area/Research-Software-Engineer_R628
- expires: 2021-09-01
location: Brown University, Providence, RI
name: Director of Research Administration Information Systems
url: https://brown.wd5.myworkdayjobs.com/en-US/staff-careers-brown/job/South-Street-Landing/Director-of-Research-Administration-Information-Systems_REQ171590
- expires: 2021-08-14
location: Ohio Supercomputer Center / The Ohio State University, Columbus, OH or
remote
name: Web and Interface Application Lead Engineer
url: https://osu.wd1.myworkdayjobs.com/en-US/OSUCareers/job/Columbus-Campus/Web---Interface-App-Lead-Engineer_R17290
- expires: 2021-09-01
location: Purdue University, West Lafayette, IN
name: Research Software Engineer
url: https://careers.purdue.edu/job/West-Lafayette-Software-Engineer-IN-47906/746526900/
- expires: 2021-08-10
location: Scripps Research, San Diego, CA or remote in US
name: 'Bioinformatics Staff Scientist (Ph.D.) or Software Engineer: API interoperability'
url: https://careers.iscb.org/jobs/view/7598
- expires: 2021-06-09
location: Oxford Biomedical Image Analysis Laboratory, Department of Engineering
Science, University of Oxford, UK
name: Senior Machine Learning in Medical Imaging Research Software & Systems Engineer
url: https://eng.ox.ac.uk/jobs/job-detail/?vacancyID=151088
- expires: 2021-08-01
location: Oak Ridge National Laboratory, Oak Ridge, TN
name: Neutron Data and Computing Program Manager
url: https://jobs.ornl.gov/job/Oak-Ridge-Neutron-Data-and-Computing-Program-Manager-TN-37830/724194700/
- expires: 2021-06-01
location: Brown University, Providence, RI
name: Research Software Engineer
url: https://brown.wd5.myworkdayjobs.com/en-US/staff-careers-brown/job/180-George-Street/Research-Software-Engineer_REQ169311
- expires: 2021-05-01
location: Harvard University and/or remote
name: Scientific Data Viz Engineer
url: https://bit.ly/rse2021
- expires: 2021-06-01
location: Various locations
name: HPC Applications Performance Engineer, Hewlett Packard Enterprise
url: https://hpe.wd5.myworkdayjobs.com/Jobsathpe/job/Bloomington-Minnesota-United-States-of-America/HPC-APPLICATIONS-PERFORMANCE-ENGINEER_1080055-1
- expires: 2021-02-28
location: University of Colorado Boulder, Boulder, CO
name: Director of Research Computing
url: https://jobs.colorado.edu/jobs/JobDetail/Director-Of-Research-Computing/28523
- expires: 2021-05-01
location: Austin, Texas, worldwide (remote OK)
name: Quantsight Software Engineer, Jupyter Ecosystem
url: https://quansight.breezy.hr/p/2f215b420ac6-software-engineer-jupyter-ecosystem
- expires: 2021-05-01
location: Austin, Texas, worldwide (remote OK)
name: Quantsight Software Engineer, C++/GPU
url: https://quansight.breezy.hr/p/a489c2c12949-software-engineer-c-gpu
- expires: 2021-05-01
location: Austin, Texas, worldwide (remote OK)
name: Quantsight Software Engineer, Distributed Computing (Dask)
url: https://quansight.breezy.hr/p/428f95d75da4-software-engineer-distributed-computing--dask?source=www.quansight.com
- expires: 2021-04-01
location: Oak Ridge National Laboratory, Oak Ridge, TN (can be remote)
name: Senior Research Scientist, Application Engineering
url: https://jobs.ornl.gov/job/Oak-Ridge-Senior-Research-Scientist%2C-Application-Engineering-TN-37831/707044200/
- expires: 2021-03-15
location: Genentech, San Francisco, CA
name: Senior Informatics Analyst, Research Informatics
url: https://bit.ly/2XWhG48
- expires: 2021-10-01
location: Oak Ridge National Laboratory, Oak Ridge, TN
name: Sr. R&D Staff Software Engineering
url: https://jobs.ornl.gov/job/Oak-Ridge-Sr_-R&D-Staff-Software-Engineering-TN-37830/696572800/
- expires: 2021-04-01
location: University of Delaware, Newark, DE
name: Computer Engineer - Rapid Advancement in Process Intensification Deployment
(RAPID)
url: https://careers.udel.edu/en-us/job/496192/computer-engineer-rapid-advancement-in-process-intensification-deployment-rapid
- expires: 2021-04-01
location: Oak Ridge National Laboratory, Oak Ridge, TN
name: Environmental Informatics Research Professional
url: https://jobs.ornl.gov/job/Oak-Ridge-Environmental-Informatics-Research-Professional-TN-37831/697442500/
- expires: 2021-04-01
location: Harvard University, Cambridge, MA
name: Research Software Engineer
url: https://sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?partnerid=25240&siteid=5341&PageType=JobDetails&jobid=1543317#jobDetails=1543317_5341
- expires: 2021-04-01
location: South San Francisco, CA (currently remote)
name: Machine Learning Engineer, Calico Life Sciences
url: https://www.calicolabs.com/careers?gh_jid=4962448002
- expires: 2021-04-01
location: University of Pittsburgh
name: Research Software Engineer at Open Minds Lab
url: https://crossinvalidation.com/2020/10/28/announcing-the-open-minds-lab-pitt/
- expires: 2021-03-01
location: Harvard University, Cambridge, MA
name: Data Scientist / Engineer
url: https://sjobs.brassring.com/TGnewUI/Search/home/HomeWithPreLoad?partnerid=25240&siteid=5341&PageType=JobDetails&jobid=1542050#jobDetails=1542050_5341
- expires: 2021-03-01
location: Harvard University, Cambridge, MA
name: Research Software Engineer (Scientific Software Developer)
url: https://www.rc.fas.harvard.edu/about/employment/#Research_Software_Engineer_Scientific_Software_Developer
- expires: 2021-01-15
location: Stanford, CA
name: Oncology OnCore Application Specialist, Stanford School of Medicine
url: https://careersearch.stanford.edu/jobs/oncology-oncore-application-specialist-oncore-reporting-group-lead-9854?et=Ysg27Ti9
- expires: 2021-01-15
location: Boston, MA
name: Senior Research Computing Systems Engineer at Boston University
url: http://www.bu.edu/tech/support/research/rcs/jobs/
- expires: 2021-01-15
location: Cambridge, MA
name: Senior Research Software Engineer (Data Engineer)
url: http://bit.ly/fasrc_senior_rse
- expires: 2021-01-15
location: Indiana University Bloomington
name: Research Software Engineer / Application Support Engineer
url: https://brainlife.io/docs/careers/jobs/
- expires: 2021-01-15
location: Indiana University Bloomington
name: Research Software Engineer / UI Engineer
url: https://brainlife.io/docs/careers/jobs/
- expires: 2021-01-15
location: Indiana University Bloomington
name: DevOps / Software Engineers
url: https://brainlife.io/docs/careers/jobs/
- expires: 2021-01-15
location: Indiana University Bloomington
name: Cloud and Cluster Administrator
url: https://brainlife.io/docs/careers/jobs/
- expires: 2021-01-15
location: Chan Zuckerberg Initiative Imaging Science, Redwood City, CA
name: Senior Software Engineer
url: https://boards.greenhouse.io/chanzuckerberginitiative/jobs/1875135?gh_jid=1875135
- expires: 2020-12-31
location: National Center for Supercomputing Applications / University of Illinois,
Urbana, IL
name: Assistant Research Programmer/Research Programmer/Senior Research Programmer
url: https://jobs.illinois.edu/academic-job-board/job-details?jobID=130370&job=research-programmer-national-center-for-supercomputing-applications-130370
- expires: 2020-12-31
location: National Center for Supercomputing Applications / University of Illinois, Urbana, IL
name: Assistant Research Programmer/Research Programmer/Senior Research Programmer
url: https://jobs.hr.wisc.edu/en-us/job/510571/researcher
- expires: 2020-12-31
location: National Center for Supercomputing Applications / University of Illinois, Urbana, IL
name: Assistant Research Programmer/Research Programmer/Senior Research Programmer
url: https://jobs.ornl.gov/job/Oak-Ridge-Full-Stack-Software-Engineer-TN-37830/793411000/

0 comments on commit 13a395a

Please sign in to comment.