|
40 | 40 | # Project name to use when running "docker compose" prior to e2e tests |
41 | 41 | COMPOSE_PROJECT_NAME: 'ci' |
42 | 42 | # Docker Registry to use for Docker compose scripts below. |
43 | | - # We use GitHub's Container Registry to avoid aggressive rate limits at DockerHub. |
44 | | - DOCKER_REGISTRY: ghcr.io |
| 43 | + # On the upstream dspace/dspace-angular repository we use GitHub's Container Registry |
| 44 | + # (ghcr.io) to avoid aggressive rate limits at DockerHub. Forks cannot authenticate |
| 45 | + # against ghcr.io/dspace/* with their own GITHUB_TOKEN (and the images there require |
| 46 | + # auth), so on forks we fall back to docker.io where the same images are public. |
| 47 | + DOCKER_REGISTRY: ${{ github.repository == 'dspace/dspace-angular' && 'ghcr.io' || 'docker.io' }} |
45 | 48 | strategy: |
46 | 49 | # Create a matrix of Node versions to test against (in parallel) |
47 | 50 | matrix: |
@@ -121,9 +124,14 @@ jobs: |
121 | 124 | path: 'coverage/dspace-angular/lcov.info' |
122 | 125 | retention-days: 14 |
123 | 126 |
|
124 | | - # Login to our Docker registry, so that we can access private Docker images using "docker compose" below. |
| 127 | + # Login to our Docker registry, so that we can access Docker images using "docker compose" below. |
| 128 | + # This login is required on the upstream repository because DOCKER_REGISTRY is set to ghcr.io |
| 129 | + # and pulling ghcr.io/dspace/* requires authentication. On forks, DOCKER_REGISTRY falls back to |
| 130 | + # docker.io (see env block above) where the same images are publicly pullable without a login, |
| 131 | + # and forks cannot authenticate against ghcr.io/dspace/* with their own GITHUB_TOKEN anyway. |
125 | 132 | - name: Login to ${{ env.DOCKER_REGISTRY }} |
126 | 133 | uses: docker/login-action@v4 |
| 134 | + if: github.repository == 'dspace/dspace-angular' |
127 | 135 | with: |
128 | 136 | registry: ${{ env.DOCKER_REGISTRY }} |
129 | 137 | username: ${{ github.repository_owner }} |
@@ -314,6 +322,9 @@ jobs: |
314 | 322 | codecov: |
315 | 323 | # Must run after 'tests' job above |
316 | 324 | needs: tests |
| 325 | + # Only run on the upstream repository: forks do not have the CODECOV_TOKEN secret, |
| 326 | + # and Codecov refuses to create a commit on a protected branch without a token. |
| 327 | + if: github.repository == 'dspace/dspace-angular' |
317 | 328 | runs-on: ubuntu-latest |
318 | 329 | steps: |
319 | 330 | - name: Checkout |
|
0 commit comments