Skip to content

Commit cf811e0

Browse files
authored
Merge pull request #251 from data-engineering-collective/auto_open_issues
Automatically open issues if CI breaks
2 parents ebfac02 + 1d12baa commit cf811e0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,25 @@ jobs:
7171
file: ./coverage.xml
7272
token: ${{ secrets.CODECOV_TOKEN }}
7373
name: pytest-${{ matrix.environment }}
74+
- name: Issue on failure
75+
uses: actions/github-script@v7
76+
if: ${{ failure() && github.ref == 'refs/heads/main' }}
77+
with:
78+
script: |
79+
github.rest.issues.listForRepo({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
state: "open",
83+
labels: "[bot] Daily run"
84+
}).then((issues) => {
85+
if (issues.data.length === 0){
86+
github.rest.issues.create({
87+
owner: context.repo.owner,
88+
repo: context.repo.repo,
89+
title: "Daily run failure",
90+
body: "The daily unit tests failed. See https://github.com/data-engineering-collective/plateau/actions/runs/${{github.run_id}} for details.",
91+
assignees: ["fjetter"],
92+
labels: ["[bot] Daily run"]
93+
})
94+
}
95+
});

.github/workflows/nighlies.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,25 @@ jobs:
5050

5151
- name: Pytest
5252
run: pixi run test-coverage -n auto
53+
- name: Issue on failure
54+
uses: actions/github-script@v7
55+
if: ${{ failure() && github.ref == 'refs/heads/main' }}
56+
with:
57+
script: |
58+
github.rest.issues.listForRepo({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
state: "open",
62+
labels: "[bot] Nightly run"
63+
}).then((issues) => {
64+
if (issues.data.length === 0){
65+
github.rest.issues.create({
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
title: "Nightly run failure",
69+
body: "The nightly unit tests failed. See https://github.com/data-engineering-collective/plateau/actions/runs/${{github.run_id}} for details.",
70+
assignees: ["fjetter"],
71+
labels: ["[bot] Nightly run"]
72+
})
73+
}
74+
});

0 commit comments

Comments
 (0)