aider: This change corrected the conditional expression for the Docker login step by removing the incorrect ${{ }} around secrets.DOCKERHUB_USERNAME and secrets.DOCKERHUB_PASSWORD and adding a check for the github.event_name to ensure that the login step is only executed when it's not a pull request or when the secrets are available.

# Aider chat conversation:

USER: The workflow is not valid. .github/workflows/docker-build-test.yml (Line: 30, Col: 11): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DOCKERHUB_USERNAME

ASSISTANT: ```diff
--- .github/workflows/docker-build-test.yml
+++ .github/workflows/docker-build-test.yml
@@ ... @@
       uses: docker/login-action@v3
       with:
         username: ${{ secrets.DOCKERHUB_USERNAME }}
         password: ${{ secrets.DOCKERHUB_PASSWORD }}
-      if: ${{ secrets.DOCKERHUB_USERNAME }} && ${{ secrets.DOCKERHUB_PASSWORD }}
+      if: ${{ github.event_name != 'pull_request' || (secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_PASSWORD) }}
```

This change corrects the conditional expression for the Docker login step by removing the incorrect `${{ }}` around `secrets.DOCKERHUB_USERNAME` and `secrets.DOCKERHUB_PASSWORD` and adding a check for the `github.event_name` to ensure that the login step is only executed when it's not a pull request or when the secrets are available.
This commit is contained in:
Paul Gauthier 2023-12-31 10:06:59 -08:00
parent 15c915e481
commit 1b43dddec5

View file

@ -27,7 +27,7 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
if: ${{ secrets.DOCKERHUB_USERNAME }} && ${{ secrets.DOCKERHUB_PASSWORD }}
if: ${{ github.event_name != 'pull_request' || (secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_PASSWORD) }}
- name: Build Docker image
uses: docker/build-push-action@v5