Skip to content

Commit 93c8bc4

Browse files
authored
Add matrix job to ci.yml to reduce conflicts (#263)
2 parents 692b338 + 22bb320 commit 93c8bc4

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

cookiecutter.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"include_example_code": "n",
3030
"include_cruft_update_github_workflow": "n",
3131
"use_extended_ruff_linting": "n",
32+
"matrix_room_id": "",
3233
"_sphinx_theme": "sunpy",
3334
"_parent_project": "",
3435
"_install_requires": "",
@@ -44,6 +45,7 @@
4445
"download_url": "PyPI address for the project, optional",
4546
"documentation_url": "Documentation URL, optional",
4647
"changelog_url": "URL to the changelog, optional",
47-
"issue_tracker_url": "URL to the issue tracker, optional"
48+
"issue_tracker_url": "URL to the issue tracker, optional",
49+
"matrix_room_id": "A room ID to enable matrix notifications in the CI workflow."
4850
}
4951
}

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def bake_examples(cookies):
7979
"author_name": "test",
8080
"use_extended_ruff_linting": "y",
8181
"issue_tracker_url": "https://github.com/sunpy/sunpy/issues",
82+
"matrix_room_id": "!example:matrix.org",
8283
}
8384
)
8485
return _handle_cookiecutter_errors(result)

{{ cookiecutter.package_name }}/.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,22 @@ jobs:
137137

138138
- name: Run upload
139139
uses: pypa/gh-action-pypi-publish@v1.13.0 # zizmor: ignore[unpinned-uses]
140+
141+
{% if cookiecutter.matrix_room_id -%}
142+
notify:
143+
if: {{ "${{ !cancelled() && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') }}" }}
144+
needs: [build_dists]
145+
runs-on: ubuntu-latest
146+
environment:
147+
name: matrix
148+
steps:
149+
- uses: Cadair/matrix-notify-action@main # zizmor: ignore[unpinned-uses]
150+
with:
151+
workflow_description: "CI Workflow"
152+
matrix_token: {{ '${{ secrets.MATRIX_ACCESS_TOKEN }}' }}
153+
github_token: {{ '${{ secrets.GITHUB_TOKEN }}' }}
154+
homeserver: {{ '${{ secrets.MATRIX_HOMESERVER }}' }}
155+
roomid: '{{ cookiecutter.matrix_room_id }}'
156+
ignore_pattern: '.*(Load|report overall).*'
157+
summarise_success: true
158+
{%- endif %}

0 commit comments

Comments
 (0)