action incorrectly reports nothing to commit #1708
-
Describe the bugEDIT: updated to the correct link https://github.com/data-apis/array-api-extra/actions/runs/11108938259 shows this action saying that Reproduction Stepssee above workflow run LogsNo response Workflowname: Docs Deploy
on:
push:
branches:
- main
jobs:
docs-deploy:
runs-on: ubuntu-latest
environment:
name: docs-deploy
steps:
- uses: actions/checkout@v4
- name: Download Artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: docs-build.yml
name: docs-build
path: docs/build/
# Note, the gh-pages deployment requires setting up a SSH deploy key.
# See
# https://github.com/JamesIves/github-pages-deploy-action/tree/dev#using-an-ssh-deploy-key-
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build/
ssh-key: ${{ secrets.DEPLOY_KEY }}
force: yes Additional CommentsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You are likely encountering a race condition here. When I look at your workflows, both the build and deploy trigger from the same event (push), meaning that it may be downloading a stale artifact and thus finding that there's nothing to deploy depending on which one finishes first. You may want to re-arrange your workflows to combine the build + deploy job, or run them both independently, ie build your docs, and then deploy them in the same job. You could also use a Something like this: name: Docs Deploy
on:
push:
branches:
- main
jobs:
docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.30.0
cache: true
- name: Build Docs
run: pixi run -e docs docs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build/ # Not sure if this is the correct directory or not
ssh-key: ${{ secrets.DEPLOY_KEY }} |
Beta Was this translation helpful? Give feedback.
-
thanks for the quick response @JamesIves ! Sounds plausible, will give it a go. |
Beta Was this translation helpful? Give feedback.
-
Yep it was a race condition, thanks again @JamesIves ! Fixed with this diff diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml
index 59845b0..5ba6577 100644
--- a/.github/workflows/docs-deploy.yml
+++ b/.github/workflows/docs-deploy.yml
@@ -1,13 +1,16 @@
name: Docs Deploy
on:
- push:
+ workflow_run:
+ workflows: ["Docs Build"]
+ types: [completed]
branches:
- - main
+ - "main"
jobs:
docs-deploy:
runs-on: ubuntu-latest
+ if: ${{ github.event.workflow_run.event == 'push' }}
environment:
name: docs-deploy
steps:
@@ -27,4 +30,3 @@ jobs:
with:
folder: docs/build/
ssh-key: ${{ secrets.DEPLOY_KEY }}
- force: yes
|
Beta Was this translation helpful? Give feedback.
You are likely encountering a race condition here. When I look at your workflows, both the build and deploy trigger from the same event (push), meaning that it may be downloading a stale artifact and thus finding that there's nothing to deploy depending on which one finishes first.
You may want to re-arrange your workflows to combine the build + deploy job, or run them both independently, ie build your docs, and then deploy them in the same job. You could also use a
workflow_call
, or something to signify that the build job has finished before the other one runs, but that may be overkill for this use case.Something like this: