Skip to content

GitHub Detector can be customized with env vars #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2025

Conversation

ljones140
Copy link
Contributor

In order for GitHub to use action for Gradle Auto Submission we need to be able to set these values on the the JSON payload submitted to our snapshots API.

Added optional env var parameter:

GITHUB_DEPENDENCY_GRAPH_DETECTOR_NAME
GITHUB_DEPENDENCY_GRAPH_DETECTOR_VERSION
GITHUB_DEPENDENCY_GRAPH_DETECTOR_URL

These override the detector name, version and url if provided.

Testing

I ran ./plugin-self-test-local to test 1

Without DETECTOR env vars set maintains defaults:

{"detector":{"name":"GitHub Dependency Graph Gradle Plugin","url":"https://github.com/gradle/github-dependency-graph-gradle-plugin","version":"1.3.2"}

With new env vars set:

GITHUB_DEPENDENCY_GRAPH_DETECTOR_NAME=Lewis-super-detector
GITHUB_DEPENDENCY_GRAPH_DETECTOR_VERSION=1.1.1
GITHUB_DEPENDENCY_GRAPH_DETECTOR_URL=https://www.example.com

Snapshot detector is changed:

{"detector":{"name":"Lewis-super-detector","url":"https://www.example.com","version":"1.1.1"}

Footnotes

  1. I had to change the repo url in the script to go to my fork.

@ljones140 ljones140 changed the title GitHub Detector can be cuztomized with env vars GitHub Detector can be customized with env vars May 16, 2025
@bigdaz bigdaz merged commit 0b27887 into gradle:main May 16, 2025
15 checks passed
@bigdaz
Copy link
Member

bigdaz commented May 16, 2025

Thanks for the PR. Plugin v1.4.0 has been released and will be incorporated into gradle/actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants