Skip to content

Commit

Permalink
Adding dispatch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Gmerold committed Oct 2, 2023
1 parent 4fcb025 commit d85a69b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 167 deletions.
41 changes: 6 additions & 35 deletions .github/workflows/on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,14 @@ on:
push:

jobs:
successful-job:
test-job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Successful job
run: exit 0

failing-job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Failing job
run: exit 1

create-issue:
runs-on: ubuntu-latest
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }}
needs: [ successful-job, failing-job ]
steps:
- name: Check whether the issue already exists
id: check-issue
continue-on-error: true
- name: Dispatch
run: |
if curl -L -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/$GITHUB_REPOSITORY/issues | grep "CI run failed"; then
echo ISSUE_EXISTS="True" >> $GITHUB_OUTPUT
else
echo ISSUE_EXISTS="False" >> $GITHUB_OUTPUT
fi
- name: Create issue
if: steps.check-issue.outputs.ISSUE_EXISTS == 'False'
uses: dacbd/create-issue-action@main
with:
token: ${{ github.token }}
title: CI run failed
body: |
### Context
[Failed Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
[Codebase](https://github.com/${{ github.repository }}/tree/${{ github.sha }})
curl -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--request POST \
--data '{"event_type": "operator_change", "client_payload": { "github_ref": "${{ github.ref }}", "github_repo": "${{ github.repository }}" }}' https://api.github.com/repos/Gmerold/test-repo-2/dispatches
130 changes: 1 addition & 129 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,129 +1 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
.idea/
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

0 comments on commit d85a69b

Please sign in to comment.