Skip to content

Add guide: Track GitHub Reusable Workflows with Custom Tags#35615

Draft
alxch- wants to merge 2 commits intomasterfrom
alexc/ci-visibility-reusable-workflows-guide
Draft

Add guide: Track GitHub Reusable Workflows with Custom Tags#35615
alxch- wants to merge 2 commits intomasterfrom
alexc/ci-visibility-reusable-workflows-guide

Conversation

@alxch-
Copy link
Copy Markdown
Contributor

@alxch- alxch- commented Mar 27, 2026

Summary

  • Adds a new CI Visibility guide explaining how to use custom tags to track GitHub Reusable Workflow metadata
  • Covers tagging from the called workflow (recommended) and from the caller workflow (fallback)
  • Includes tracking version/ref, source repo, caller repo, and workflow inputs
  • Updates the CI Visibility guides index to include the new page

Context

CI Visibility does not natively extract reusable workflow metadata (version, ref, source repository). This guide shows users how to bridge the gap using datadog-ci tag.

Test plan

  • Verify the guide renders correctly on the docs preview site
  • Confirm all links resolve correctly

🤖 Generated with Claude Code

Add a new guide explaining how to use custom tags to track reusable
workflow metadata (version/ref, source repo, caller repo, and inputs)
in CI Visibility using the datadog-ci CLI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

@drichards-87 drichards-87 added the editorial review Waiting on a more in-depth review label Mar 31, 2026
@drichards-87
Copy link
Copy Markdown
Contributor

Created DOCS-13876 for the editorial review.

Use GitHub Actions REST API to resolve reusable workflow refs
automatically instead of relying on github.workflow_ref (which
returns the caller's ref). Add secrets declaration, caller examples,
and a screenshot showing the tags in CI Visibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the Images Images are added/removed with this PR label Apr 2, 2026
Copy link
Copy Markdown
Contributor

@joepeeples joepeeples left a comment

Choose a reason for hiding this comment

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

Approved with a few non-blocking formatting suggestions, thanks!


## Add reusable workflow tags from the caller workflow

If you cannot modify the shared workflow, you can tag the metadata from a separate job in the **caller** workflow instead. Use the same [GitHub Actions REST API][8] approach to look up the reusable workflow ref automatically:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
If you cannot modify the shared workflow, you can tag the metadata from a separate job in the **caller** workflow instead. Use the same [GitHub Actions REST API][8] approach to look up the reusable workflow ref automatically:
If you cannot modify the shared workflow, you can tag the metadata from a separate job in the _caller_ workflow instead. Use the same [GitHub Actions REST API][8] approach to look up the reusable workflow ref automatically:

[6]: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context
[7]: https://docs.github.com/en/actions/sharing-automations/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow
[8]: https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run
[9]: /continuous_integration/explorer/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This URL reference isn't being used in the page above, so we can omit it:

Suggested change
[9]: /continuous_integration/explorer/

{{< nextlink href="/account_management/billing/ci_visibility/" >}}CI Visibility Billing Considerations{{< /nextlink >}}
{{< nextlink href="/continuous_integration/guides/identify_highest_impact_jobs_with_critical_path/" >}}Identify CI Jobs on the Critical Path to Reduce the Pipeline Duration{{< /nextlink >}}
{{< nextlink href="/continuous_integration/guides/use_ci_jobs_failure_analysis/" >}} Use CI jobs failure analysis to identify root causes in failed jobs{{< /nextlink >}}
{{< nextlink href="/continuous_integration/guides/track_reusable_workflows/" >}} Track GitHub Reusable Workflow Usage with Custom Tags{{< /nextlink >}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{{< nextlink href="/continuous_integration/guides/track_reusable_workflows/" >}} Track GitHub Reusable Workflow Usage with Custom Tags{{< /nextlink >}}
{{< nextlink href="/continuous_integration/guides/track_reusable_workflows/" >}}Track GitHub Reusable Workflow Usage with Custom Tags{{< /nextlink >}}

Comment on lines +33 to +35
The most reliable way to tag reusable workflow metadata is to add a tagging step **inside the reusable workflow itself**. This way, every caller automatically gets the tags without extra configuration.

GitHub does not include reusable workflow metadata (such as the called workflow's ref or path) in the webhook events that Datadog receives, and the [`github.workflow_ref`][6] context variable resolves to the **caller** workflow's ref, not the called workflow's. To work around this, query the [GitHub Actions REST API][8] from within the workflow to look up the `referenced_workflows` for the current run:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Italics are more common for general emphasis like this:

Suggested change
The most reliable way to tag reusable workflow metadata is to add a tagging step **inside the reusable workflow itself**. This way, every caller automatically gets the tags without extra configuration.
GitHub does not include reusable workflow metadata (such as the called workflow's ref or path) in the webhook events that Datadog receives, and the [`github.workflow_ref`][6] context variable resolves to the **caller** workflow's ref, not the called workflow's. To work around this, query the [GitHub Actions REST API][8] from within the workflow to look up the `referenced_workflows` for the current run:
The most reliable way to tag reusable workflow metadata is to add a tagging step _inside the reusable workflow itself_. This way, every caller automatically gets the tags without extra configuration.
GitHub does not include reusable workflow metadata (such as the called workflow's ref or path) in the webhook events that Datadog receives, and the [`github.workflow_ref`][6] context variable resolves to the _caller_ workflow's ref, not the called workflow's. To work around this, query the [GitHub Actions REST API][8] from within the workflow to look up the `referenced_workflows` for the current run:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editorial review Waiting on a more in-depth review Images Images are added/removed with this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants