mirror of
https://github.com/gradle/actions.git
synced 2025-08-25 11:22:01 +08:00
Fail nicely when dependency-submission is used after setup-gradle in the same Job (#37)
Previously, this would fail with a hard-to-diagnose error message. Fixes #14
This commit is contained in:
parent
2f23d645f2
commit
b776693a71
19
.github/workflows/dependency-submission.yml
vendored
19
.github/workflows/dependency-submission.yml
vendored
@ -43,3 +43,22 @@ jobs:
|
|||||||
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||||
env:
|
env:
|
||||||
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
|
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
|
||||||
|
|
||||||
|
test-after-setup-gradle:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: ./setup-gradle
|
||||||
|
- name: Generate and submit dependencies
|
||||||
|
id: dependency-submission
|
||||||
|
uses: ./dependency-submission
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
- name: Assert step failure
|
||||||
|
if: steps.dependency-submission.outcome != 'failure'
|
||||||
|
run: |
|
||||||
|
echo "Dependency submission step should fail after setup-gradle"
|
||||||
|
exit 1
|
||||||
|
@ -50,6 +50,13 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check no setup-gradle
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ -n "${GRADLE_BUILD_ACTION_SETUP_COMPLETED}" ]; then
|
||||||
|
echo "The dependency-submission action cannot be used in the same Job as the setup-gradle action. Please use a separate Job for dependency submission."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
- name: Generate dependency graph
|
- name: Generate dependency graph
|
||||||
if: ${{ inputs.dependency-graph == 'generate-and-submit' || inputs.dependency-graph == 'generate-and-upload' }}
|
if: ${{ inputs.dependency-graph == 'generate-and-submit' || inputs.dependency-graph == 'generate-and-upload' }}
|
||||||
uses: gradle/actions/setup-gradle@v3.0.0
|
uses: gradle/actions/setup-gradle@v3.0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user