Skip to content

chore(grafana-annotation): remove usage of archived action#300

Open
MrkMrk00 wants to merge 1 commit into
mainfrom
chore/grafana-archived-action
Open

chore(grafana-annotation): remove usage of archived action#300
MrkMrk00 wants to merge 1 commit into
mainfrom
chore/grafana-archived-action

Conversation

@MrkMrk00
Copy link
Copy Markdown
Contributor

@MrkMrk00 MrkMrk00 commented May 19, 2026

The Grafana Annotation action has been archived https://github.com/hexionas/grafana-annotation-action/. This PR re-implements the annotation creation in a few lines of Bash.

The source for the old action: https://github.com/hexionas/grafana-annotation-action/blob/main/index.ts

@MrkMrk00 MrkMrk00 requested a review from Copilot May 19, 2026 06:11
@MrkMrk00 MrkMrk00 self-assigned this May 19, 2026
@MrkMrk00 MrkMrk00 added the adhoc Ad-hoc unplanned task added during the sprint. label May 19, 2026
@github-actions github-actions Bot added the t-infra Issues with this label are in the ownership of the infrastructure team. label May 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the archived hexionas/grafana-annotation-action usage in the reusable Grafana annotation workflow with an inline Bash implementation that calls Grafana’s annotations API directly.

Changes:

  • Replaced the third-party Grafana annotation GitHub Action with a curl-based Bash step.
  • Added logic to POST (create) or PATCH (update) an annotation based on whether an annotation ID is provided.
  • Normalized workflow-call output wiring/indentation for annotation_id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/grafana_annotation.yaml Outdated
Comment thread .github/workflows/grafana_annotation.yaml Outdated
Comment thread .github/workflows/grafana_annotation.yaml Outdated
@MrkMrk00 MrkMrk00 force-pushed the chore/grafana-archived-action branch from a04da53 to a221104 Compare May 19, 2026 06:22
@MrkMrk00 MrkMrk00 requested a review from Copilot May 19, 2026 06:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/grafana_annotation.yaml
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

.github/workflows/grafana_annotation.yaml:83

  • echo "annotation-id=..." >> "$GITHUB_OUTPUT" uses a hyphenated output name. To keep output naming consistent (and to match the annotation_id job/workflow outputs), write annotation_id=... instead and update references accordingly.
          if [[ "$method" == 'POST' ]]; then
            id=$(jq -r '.id' <<< "$response")
            echo "annotation-id=$id" >> "$GITHUB_OUTPUT"
          else
            echo "annotation-id=$GRAFANA_ANNOTATION_ID" >> "$GITHUB_OUTPUT"
          fi

Comment thread .github/workflows/grafana_annotation.yaml
fix(grafana-annotation): correct curl URL, payload key, PATCH semantics and tag parsing

- Pass $endpoint to curl (was missing — every request failed with "no URL specified")
- Fix "test" → "text" so the annotation text is actually stored
- PATCH now updates only timeEnd (mirrors the archived action's close-out behaviour)
- Build JSON body with jq (escapes text correctly, removes injection vector)
- Parse newline-separated tags with `jq -Rn` so plain-string tags work
- Drop `set -x` so the Authorization header isn't xtraced
- `jq -r '.id'` for unquoted output, quote $GITHUB_OUTPUT
@MrkMrk00 MrkMrk00 force-pushed the chore/grafana-archived-action branch from a221104 to 3a0664a Compare May 20, 2026 14:31
@MrkMrk00 MrkMrk00 requested a review from fnesveda May 20, 2026 14:32
@MrkMrk00 MrkMrk00 marked this pull request as ready for review May 20, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-infra Issues with this label are in the ownership of the infrastructure team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants