forked from nextcloud/server
-
Notifications
You must be signed in to change notification settings - Fork 0
jfrog add workflow info #184
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ef85f04
IONOS(build): enhance JFrog upload properties for better artifact met…
printminion-co d170ead
IONOS(build): fix branch reference in JFrog properties
printminion-co e054010
IONOS(build): create get-job-data action to retrieve GitHub workflow …
printminion-co 9cc64a2
IONOS(build): add source build URL for traceability in GitLab pipelin…
printminion-co 39a6488
IONOS(build): enhance cache handling with optional version suffix and…
printminion-co File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: 'Get Job Data from GitHub Actions' | ||
| description: 'Fetches the GitHub Actions job data from the GitHub API' | ||
| inputs: | ||
| job-name: | ||
| description: 'The name of the job to find' | ||
| required: true | ||
| github-token: | ||
| description: 'GitHub token for API authentication' | ||
| required: true | ||
| repository: | ||
| description: 'Repository in owner/repo format' | ||
| required: true | ||
| run-id: | ||
| description: 'GitHub Actions run ID' | ||
| required: true | ||
| outputs: | ||
| job_html_url: | ||
| description: 'The HTML URL of the job' | ||
| value: ${{ steps.get_url.outputs.job_html_url }} | ||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Fetch job URL from GitHub API | ||
| id: get_url | ||
| shell: bash | ||
| run: | | ||
| # Fetch the numeric job ID from GitHub API | ||
| CURL_ERROR_FILE=$(mktemp) | ||
| NETRC_FILE=$(mktemp) | ||
printminion-co marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Write GitHub API credentials to a temporary netrc file to avoid | ||
| # passing the token directly on the curl command line. | ||
| printf '%s\n' \ | ||
| 'machine api.github.com' \ | ||
| ' login x-access-token' \ | ||
| " password ${{ inputs.github-token }}" \ | ||
| > "$NETRC_FILE" | ||
| chmod 600 "$NETRC_FILE" | ||
|
|
||
| # Ensure temporary file cleanup on exit | ||
| cleanup() { | ||
| if [ -n "$CURL_ERROR_FILE" ] && [ -f "$CURL_ERROR_FILE" ]; then | ||
| rm -f "$CURL_ERROR_FILE" | ||
| fi | ||
| if [ -n "$NETRC_FILE" ] && [ -f "$NETRC_FILE" ]; then | ||
| rm -f "$NETRC_FILE" | ||
| fi | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| API_RESPONSE=$(curl -sS -w "\n%{http_code}" \ | ||
| --netrc-file "$NETRC_FILE" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${{ inputs.repository }}/actions/runs/${{ inputs.run-id }}/jobs" 2>"$CURL_ERROR_FILE") | ||
|
|
||
| CURL_EXIT_CODE=$? | ||
| if [ $CURL_EXIT_CODE -ne 0 ]; then | ||
| echo "❌ ERROR: curl request to GitHub API failed with exit code $CURL_EXIT_CODE" | ||
| if [ -s "$CURL_ERROR_FILE" ]; then | ||
| echo "curl error output:" | ||
| cat "$CURL_ERROR_FILE" | ||
| fi | ||
| echo "job_html_url=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
printminion-co marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| HTTP_CODE=$(echo "$API_RESPONSE" | tail -n1) | ||
| RESPONSE_BODY=$(echo "$API_RESPONSE" | sed '$d') | ||
|
|
||
| if [ "$HTTP_CODE" != "200" ]; then | ||
| echo "⚠️ WARNING: GitHub API request failed with $HTTP_CODE" | ||
| echo "job_html_url=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| EXPECTED_JOB_NAME="${{ inputs.job-name }}" | ||
| JOB_URL=$(echo "$RESPONSE_BODY" | jq -r \ | ||
| --arg job_name "$EXPECTED_JOB_NAME" \ | ||
| '.jobs[] | select(.name == $job_name) | .html_url') | ||
|
|
||
| if [ -z "$JOB_URL" ] || [ "$JOB_URL" = "null" ]; then | ||
| echo "⚠️ WARNING: Failed to extract job URL from response for job name '$EXPECTED_JOB_NAME'." | ||
| echo "Possible causes:" | ||
| echo " - The job name does not match exactly (including spaces and case)." | ||
| echo " - The job has not started yet at the time this action ran." | ||
| echo " - The GitHub API response format was unexpected." | ||
| echo "Please verify that the job has started before this action runs and double-check the exact job name in the GitHub Actions UI." | ||
| echo "job_html_url=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "job_html_url=$JOB_URL" >> "$GITHUB_OUTPUT" | ||
| echo "Job URL: $JOB_URL" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.