-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding a job back Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
263 additions
and
163 deletions.
There are no files selected for viewing
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
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 |
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
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
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 |
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
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 $? |
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
Oops, something went wrong.