-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathaction.yaml
More file actions
97 lines (91 loc) · 2.9 KB
/
Copy pathaction.yaml
File metadata and controls
97 lines (91 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Create Issue From pytest log
description: >-
Create an issue for failed tests from a pytest-reportlog file.
inputs:
log-path:
description: >-
The path to the log file
required: true
issue-title:
description: >-
Title of issue being created or updated. Can be a parametrized string, in which case
a new issue will be opened for all variations.
required: false
default: "⚠️ Nightly upstream-dev CI failed ⚠️"
issue-label:
description: >-
Labels to apply to issue
required: false
default: "CI"
assignees:
description: >-
Comma-separated users to assign to the issue (no spaces). All assigned users have to
have commit rights.
required: false
default: ""
outputs: {}
branding:
color: "red"
icon: "alert-triangle"
runs:
using: composite
steps:
- name: setup uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # 8.2.0
with:
python-version: "3.13"
working-directory: ${{ github.action_path }}
enable-cache: "false"
- name: produce the issue body
shell: bash
id: formatter
env:
UV_PROJECT: ${{ github.action_path }}
LOG_PATH: ${{ inputs.log-path }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
ISSUE_BODY: ${{ github.action_path }}/issue-body.md
run: |
uv run --frozen $GITHUB_ACTION_PATH/format_issue_body.py "$LOG_PATH" "$WORKFLOW_URL" "$ISSUE_BODY"
echo "ISSUE_BODY=$ISSUE_BODY" >> $GITHUB_OUTPUT
- name: inspect the results
shell: bash
env:
LOG_PATH: ${{ inputs.log-path }}
ISSUE_BODY: ${{ steps.formatter.outputs.ISSUE_BODY }}
run: |
# issue body
echo "::group::issue body"
cat "$ISSUE_BODY"
echo "::endgroup::"
- name: create the issue
shell: bash
env:
ASSIGNEES: ${{ inputs.assignees }}
ISSUE_TITLE: ${{ inputs.issue-title }}
ISSUE_LABEL: ${{ inputs.issue-label }}
CREATOR: "app/github-actions"
ISSUE_BODY: ${{ steps.formatter.outputs.ISSUE_BODY }}
GH_TOKEN: ${{ github.token }}
run: |
issues=$(
gh issue list \
--repo "$GITHUB_REPOSITORY" \
-S "in:title $ISSUE_TITLE" \
--state open \
--author $CREATOR \
--json number,title,author,assignees \
-L 1
);
if [[ $(echo "$issues" | jq 'length') -eq 1 ]]; then
gh issue edit \
--repo "$GITHUB_REPOSITORY" \
"$(echo "$issues" | jq '.[] | .number')" \
--body-file $ISSUE_BODY
else
gh issue new \
--repo "$GITHUB_REPOSITORY" \
--assignee "$ASSIGNEES" \
--label "$ISSUE_LABEL" \
--title "$ISSUE_TITLE" \
--body-file $ISSUE_BODY
fi