diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a16732be..4268ea34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,9 +102,13 @@ jobs: # Pin version for Java 8, also be sure to set in verify-pr.yml mcHelperVersion: 1.51.3-java8 env: + # Assume they line up, but when forked change to your Docker Hub username + DOCKER_HUB_ORG: ${{ github.repository_owner }} IMAGE_TO_TEST: "${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}" HAS_IMAGE_REPO_ACCESS: ${{ secrets.DOCKER_USER != '' && secrets.DOCKER_PASSWORD != '' }} MAIN_VARIANT: java25 + PUSH: ${{ github.repository_owner == 'itzg' }} + IMAGE_AUTHOR: "Geoff Bourne " runs-on: ubuntu-22.04 steps: - name: Checkout @@ -117,10 +121,8 @@ jobs: id: meta uses: docker/metadata-action@v6.2.0 with: - # NOTE for forks: if your Docker Hub organization doesn't match your Github repo's, - # then the use of ${{ github.repository_owner }} will need to be replaced. images: | - ${{ github.repository_owner }}/minecraft-server + ${{ env.DOCKER_HUB_ORG }}/minecraft-server ghcr.io/${{ github.repository_owner }}/minecraft-server tags: | # Apply the variant as a moving tag for most recent commit per variant @@ -142,7 +144,7 @@ jobs: flavor: | latest=${{ matrix.variant == env.MAIN_VARIANT && github.ref_name == github.event.repository.default_branch }} labels: | - org.opencontainers.image.authors=Geoff Bourne + org.opencontainers.image.authors=${{ env.IMAGE_AUTHOR }} - name: Setup Docker Buildx uses: docker/setup-buildx-action@v4 @@ -198,13 +200,16 @@ jobs: platforms: ${{ matrix.platforms }} push: > ${{ - github.ref_type == 'tag' - || github.ref_name == github.event.repository.default_branch - || startsWith(github.ref_name, 'test/') - || ( github.event_name == 'pull_request' - && env.HAS_IMAGE_REPO_ACCESS - && contains(github.event.pull_request.labels.*.name, 'ci/push-image') - ) + env.PUSH && + ( + github.ref_type == 'tag' + || github.ref_name == github.event.repository.default_branch + || startsWith(github.ref_name, 'test/') + || ( github.event_name == 'pull_request' + && env.HAS_IMAGE_REPO_ACCESS + && contains(github.event.pull_request.labels.*.name, 'ci/push-image') + ) + ) }} tags: ${{ steps.meta.outputs.tags }} # ensure latest base image is used @@ -221,5 +226,6 @@ jobs: REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }} ${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }} + IMAGE_AUTHOR=${{ env.IMAGE_AUTHOR }} cache-from: type=gha,scope=${{ matrix.variant }} cache-to: type=gha,mode=max,scope=${{ matrix.variant }} diff --git a/.github/workflows/discord.yml b/.github/workflows/discord.yml index 20cc2eaf..3af21737 100644 --- a/.github/workflows/discord.yml +++ b/.github/workflows/discord.yml @@ -16,6 +16,7 @@ jobs: discord: runs-on: ubuntu-latest timeout-minutes: 5 + if: github.repository_owner == 'itzg' steps: - name: on-publish if: github.event_name == 'release' && github.event.action == 'published' diff --git a/.github/workflows/issue-label.yml b/.github/workflows/issue-notify.yml similarity index 90% rename from .github/workflows/issue-label.yml rename to .github/workflows/issue-notify.yml index dcf97167..2f19e9c8 100644 --- a/.github/workflows/issue-label.yml +++ b/.github/workflows/issue-notify.yml @@ -13,6 +13,7 @@ on: - labeled jobs: notify: + if: github.repository_owner == 'itzg' uses: itzg/github-workflows/.github/workflows/issues-notify-discord.yml@main with: triageLabel: 'status/needs triage' diff --git a/.github/workflows/stale-check.yml b/.github/workflows/stale-check.yml index 70a505ca..77e2707f 100644 --- a/.github/workflows/stale-check.yml +++ b/.github/workflows/stale-check.yml @@ -7,6 +7,7 @@ on: jobs: check: runs-on: ubuntu-22.04 + if: github.repository_owner == 'itzg' permissions: issues: write pull-requests: write