Skip to content

Commit 38d34b6

Browse files
committed
create issue when nightly tests fail
Signed-off-by: Moritz Wiesinger <[email protected]>
1 parent f46b86c commit 38d34b6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/base-package-tests.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
distribution:
1010
required: true
1111
type: string
12+
issue-on-failure:
13+
required: false
14+
type: boolean
15+
default: false
16+
description: "Set to true if a GH issue should be generated upon failure"
1217

1318
jobs:
1419
package-tests:
@@ -28,3 +33,29 @@ jobs:
2833

2934
- name: Test ${{ matrix.type }} package
3035
run: ./scripts/package-tests/package-tests.sh ./otelcol*-SNAPSHOT-*_linux_amd64.${{ matrix.type }} ${{ inputs.distribution }}
36+
37+
create-issue:
38+
name: Create GitHub Issue
39+
runs-on: ubuntu-24.04
40+
needs: [package-tests]
41+
if: failure() && inputs.issue-on-failure == 'true'
42+
steps:
43+
- name: Formulate issue
44+
id: formulate_issue
45+
run: |
46+
# create a markdown file that contains details about the failure
47+
echo "The nightly linux package tests failed in the following GitHub actions run." > nightly-test-failure.md
48+
echo "* Link to run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> nightly-test-failure.md
49+
echo "* Triggered by: Nightly scheduled build" >> nightly-test-failure.md
50+
echo "" >> nightly-test-failure.md
51+
echo "Note: This issue was auto-generated from [base-package-tests.yaml](https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.github/workflows/base-package-tests.yaml)" >> nightly-test-failure.md
52+
53+
- name: Create issue on failure
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
56+
run: |
57+
gh issue create \
58+
--repo open-telemetry/opentelemetry-collector-contrib \
59+
--title "Nightly Linux Package Tests Failed" \
60+
--body-file nightly-test-failure.md \
61+
--label "release:blocker"

.github/workflows/package-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ jobs:
2222
with:
2323
distribution: otelcol-contrib
2424
type: '[ "deb", "rpm" ]'
25+
issue-on-failure: true

0 commit comments

Comments
 (0)