From 702b95d7474a1873d09f9222c5fee5ede69609d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=98=D0=B0=D0=BD=20=D0=93=D0=B5=D0=BE?= =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=B5=D0=B2=D1=81=D0=BA=D0=B8?= Date: Mon, 7 Aug 2023 16:57:54 +0200 Subject: [PATCH 1/3] docker: don't push on a Pull Request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the github action triggers on a PR too, `github.ref` will be the target branch for merging (typically `develop`). In that case, don't try to login/push to docker hub. https://docs.github.com/en/actions/learn-github-actions/contexts#github-context Signed-off-by: Дамјан Георгиевски --- .github/workflows/docker-hub-latest.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-hub-latest.yml b/.github/workflows/docker-hub-latest.yml index ea2693614..91d359bf9 100644 --- a/.github/workflows/docker-hub-latest.yml +++ b/.github/workflows/docker-hub-latest.yml @@ -11,7 +11,8 @@ env: DOCKER_NAMESPACE: matrixdotorg PLATFORMS: linux/amd64 # Only push if this is develop, otherwise we just want to build - PUSH: ${{ github.ref == 'refs/heads/develop' }} + # On a PR github.ref is the target branch, so don't push for that either + PUSH: ${{ github.ref == 'refs/heads/develop' && github.event_name != 'pull_request' }} jobs: docker-latest: @@ -34,4 +35,4 @@ jobs: platforms: ${{ env.PLATFORMS }} push: ${{ env.PUSH }} tags: | - ${{ env.DOCKER_NAMESPACE }}/matrix-appservice-irc:latest \ No newline at end of file + ${{ env.DOCKER_NAMESPACE }}/matrix-appservice-irc:latest From 3944747d2a14faa8e5b8e060db7393d277f8d845 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Mon, 7 Aug 2023 16:41:14 +0100 Subject: [PATCH 2/3] Create 1767.bugfix --- changelog.d/1767.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/1767.bugfix diff --git a/changelog.d/1767.bugfix b/changelog.d/1767.bugfix new file mode 100644 index 000000000..491f57ffc --- /dev/null +++ b/changelog.d/1767.bugfix @@ -0,0 +1 @@ +Fix GitHub CI docker builds failing for community PRs. From a7be8d989db1f41e67835ee72ab7afc282dc3d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=98=D0=B0=D0=BD=20=D0=93=D0=B5=D0=BE?= =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=B5=D0=B2=D1=81=D0=BA=D0=B8?= Date: Mon, 7 Aug 2023 17:52:03 +0200 Subject: [PATCH 3/3] check if env.PUSH is the "true" string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Дамјан Георгиевски --- .github/workflows/docker-hub-latest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-hub-latest.yml b/.github/workflows/docker-hub-latest.yml index 91d359bf9..57e03d3fa 100644 --- a/.github/workflows/docker-hub-latest.yml +++ b/.github/workflows/docker-hub-latest.yml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v3 - name: Login to Docker Hub uses: docker/login-action@v2 - if: ${{ env.PUSH }} + if: ${{ env.PUSH == 'true' }} with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }}