Skip to content

Commit

Permalink
Add Issue templates and automation scripts (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopgrassi authored Mar 19, 2024
1 parent 0220d78 commit 4f25eb5
Show file tree
Hide file tree
Showing 12 changed files with 435 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Bug report
description: Create a report to help us improve
labels: ["bug", "triage:needs-triage"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Please make sure to fill out the entire form below, providing as much context as you can in order to help us triage and track down your bug as quickly as possible.
Before filing a bug, please be sure you have searched through [existing bugs](https://github.com/open-telemetry/semantic-conventions/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abug) to see if an existing issue covers your bug.
- type: dropdown
id: area
attributes:
label: Area(s)
description: Which area(s) does your bug report concern? If none fits, please select `area:other`
multiple: true
options:
- area:other
# NOTE: The list below is autogenerated using `make generate-gh-issue-templates`
# DO NOT manually edit it.
# Start semconv area list
- area:android
- area:browser
- area:client
- area:cloud
- area:code
- area:container
- area:db
- area:destination
- area:device
- area:disk
- area:dns
- area:error
- area:exception
- area:faas
- area:host
- area:http
- area:k8s
- area:messaging
- area:network
- area:oci
- area:os
- area:process
- area:rpc
- area:server
- area:source
- area:thread
- area:tls
- area:url
- area:user-agent
# End semconv area list
- type: textarea
attributes:
label: What happened?
description: Please provide as much detail as you reasonably can.
value: |
## Description
## Steps to Reproduce (if any)
## Expected Result
## Actual Result
validations:
required: true

- type: input
attributes:
label: Semantic convention version
description: What version did you use? (e.g., `v1.24.0`, `1eb551b`, etc)
validations:
required: true

- type: textarea
attributes:
label: Additional context
description: Any additional information you think may be relevant to this issue.
64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE/change_proposal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Propose changes to existing conventions
description: Propose changes you'd like to be added to existing conventions
labels: ["enhancement", "triage:needs-triage"]
body:
- type: dropdown
id: area
attributes:
label: Area(s)
description: Which area(s) does your change request concern?
multiple: true
options:
# NOTE: The list below is autogenerated using `make generate-gh-issue-templates`
# DO NOT manually edit it.
# Start semconv area list
- area:android
- area:browser
- area:client
- area:cloud
- area:code
- area:container
- area:db
- area:destination
- area:device
- area:disk
- area:dns
- area:error
- area:exception
- area:faas
- area:host
- area:http
- area:k8s
- area:messaging
- area:network
- area:oci
- area:os
- area:process
- area:rpc
- area:server
- area:source
- area:thread
- area:tls
- area:url
- area:user-agent
# End semconv area list
- type: textarea
attributes:
label: Is your change request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
73 changes: 73 additions & 0 deletions .github/ISSUE_TEMPLATE/new-conventions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Propose new semantic conventions
description: Propose new conventions you'd like to be part of the OpenTelemetry project
labels: ["enhancement", "triage:needs-triage", "experts needed"]
body:
- type: markdown
attributes:
value: |
Please make sure to fill out the entire form below, providing as much context as you can in order to help us triage the proposal as quickly as possible.
Before filing the proposal, please be sure you have searched through [existing issues](https://github.com/open-telemetry/semantic-conventions/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aenhancement+label%3Aarea:new) to see if an existing issue covers your proposal.
Additionally, make sure to read and follow the guidelines on [Project Proposal](https://github.com/open-telemetry/community/blob/main/project-management.md#project-management), in case the proposal is for a new set of conventions/working group.
- type: dropdown
id: area
attributes:
label: Area(s)
description: Which area(s) does your new conventions concern? If none fits, please select `area:new`
multiple: true
options:
- area:new
# NOTE: The list below is autogenerated using `make generate-gh-issue-templates`
# DO NOT manually edit it.
# Start semconv area list
- area:android
- area:browser
- area:client
- area:cloud
- area:code
- area:container
- area:db
- area:destination
- area:device
- area:disk
- area:dns
- area:error
- area:exception
- area:faas
- area:host
- area:http
- area:k8s
- area:messaging
- area:network
- area:oci
- area:os
- area:process
- area:rpc
- area:server
- area:source
- area:thread
- area:tls
- area:url
- area:user-agent
# End semconv area list
- type: textarea
attributes:
label: Is your change request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
9 changes: 9 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,12 @@ jobs:
- uses: actions/checkout@v1
- name: verify schemas
run: make schema-check

areas-dropdown-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Components dropdown in issue templates
run: |
make generate-gh-issue-templates
git diff --exit-code '.github/ISSUE_TEMPLATE' || (echo 'Dropdowns in issue templates is out of date, please run "make generate-gh-issue-templates" and commit the changes in this PR.' && exit 1)
24 changes: 24 additions & 0 deletions .github/workflows/generate-registry-area-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Generate registry area labels'
on:
push:
branches: [main]
paths:
- model/registry/**
- ./.github/workflows/generate-registry-area-labels.yml
- ./.github/workflows/scripts/generate-registry-area-labels.sh
workflow_dispatch:

jobs:
generate-component-labels:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'open-telemetry' }}
steps:
- uses: actions/checkout@v4

- name: Run update permissions
run: chmod +x ./.github/workflows/scripts/generate-registry-area-labels.sh

- name: Generate registry area labels
run: ./.github/workflows/scripts/generate-registry-area-labels.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/prepare-new-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Prepare new issue'
on:
issues:
types: [opened]

jobs:
prepare-new-issue:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'open-telemetry' }}
steps:
- uses: actions/checkout@v4

- name: Run update permissions
run: chmod +x ./.github/workflows/scripts/prepare-new-issue.sh

- name: Run prepare-new-issue.sh
run: ./.github/workflows/scripts/prepare-new-issue.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.number }}
BODY: ${{ github.event.issue.body }}
OPENER: ${{ github.event.issue.user.login }}
34 changes: 34 additions & 0 deletions .github/workflows/scripts/generate-registry-area-labels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#
# Create labels for all semantic convention areas that are in model/registry.
# Existing labels are not affected.
#
# Note that there is a 50-character limit on labels, so some areas may
# not have a corresponding label.

set -euo pipefail

CUR_DIRECTORY=$(dirname "$0")
AREAS=$(sh "${CUR_DIRECTORY}/get-registry-areas.sh")

echo -e "\nStarting to create area labels"
echo -e "--------------------------------\n"

for AREA in ${AREAS}; do
LABEL_NAME=$(basename "${AREA}" .yaml)

if (( "${#LABEL_NAME}" > 50 )); then
echo "'${LABEL_NAME}' exceeds GitHubs 50-character limit on labels, skipping"
continue
fi
echo "area:${LABEL_NAME}"

# gh label create "area:${LABEL_NAME}" -c "#425cc7"
done

echo -e "\nLabels created successfully"
echo -e "--------------------------------\n"

16 changes: 16 additions & 0 deletions .github/workflows/scripts/get-registry-areas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#
# Get a list of the semantic conventions areas from the registry.

CUR_DIRECTORY=$(dirname "$0")
REPO_DIR="$( cd "$CUR_DIRECTORY/../../../" && pwd )"
REGISTRY_DIR="$( cd "$REPO_DIR/model/registry" && pwd )"


for entry in $(ls $REGISTRY_DIR | egrep '\.yaml$' | sort)
do
echo "$entry"
done
62 changes: 62 additions & 0 deletions .github/workflows/scripts/prepare-new-issue.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
#
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#
#

# This script extracts the "Area" from the issue body and adds it as a label
# on newly created issues. The area from the issue body comes from
# the "Area" drop-down field in the ISSUE_TEMPLATE, which is auto-generated
# from the files inside model/registry.

# TODO: This script can be later used to also auto-assign the correct code-owner
# once that is implemented.

set -euo pipefail

if [[ -z "${ISSUE:-}" || -z "${BODY:-}" || -z "${OPENER:-}" ]]; then
echo "Missing one of ISSUE, BODY, or OPENER, please ensure all are set."
exit 0
fi

LABELS=""
AREAS_SECTION_START=$( (echo "${BODY}" | grep -n '### Area(s)' | awk '{ print $1 }' | grep -oE '[0-9]+') || echo '-1' )
BODY_AREAS=""

if [[ "${AREAS_SECTION_START}" != '-1' ]]; then
BODY_AREAS=$(echo "${BODY}" | sed -n $((AREAS_SECTION_START+2))p)
fi

for AREA in ${BODY_AREAS}; do
# Areas are delimited by ', ' and the for loop separates on spaces, so remove the extra comma.
AREA=${AREA//,/}

if (( "${#AREA}" > 50 )); then
echo "'${AREA}' exceeds GitHub's 50-character limit on labels, skipping adding a label"
continue
fi

if [[ -n "${LABELS}" ]]; then
LABELS+=","
fi
LABELS+="${AREA}"
done

if [[ -v PINGED_AREAS[@] ]]; then
echo "The issue was associated with areas:" "${!PINGED_AREAS[@]}"
else
echo "No related areas were given"
fi

if [[ -n "${LABELS}" ]]; then
# Notes on this call:
# 1. Labels will be deduplicated by the GitHub CLI.
# 2. The call to edit the issue will fail if any of the
# labels doesn't exist. We can be reasonably sure that
# all labels will exist since they come from a known set.
echo "Adding the following labels: ${LABELS//,/ /}"
gh issue edit "${ISSUE}" --add-label "${LABELS}" || true
else
echo "No labels were found to add"
fi
Loading

0 comments on commit 4f25eb5

Please sign in to comment.