Closed dbsanfte closed 2 weeks ago
I patched the v0.6
version of the action with this on a local fork:
- name: Get Deployment Type
run: |
cd ${{ inputs.root-folder }}
branch=$(echo "${GITHUB_REF#refs/heads/}")
echo "Our ref is: $branch"
# DS: handle no `github.event.before` on tags push event:
if [[ "$branch" == refs/tags/* ]]
then
dags_only=0
else
git fetch origin $branch
files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
echo "files changed: $files"
dags_only=1
for file in $files; do
if [[ $file != *"dags/"* ]]; then
echo $file is not a DAG, triggering a full image build
dags_only=0
break
fi
done
fi
if [[ ${{steps.dag-deploy-enabled.outputs.DAG_DEPLOY_ENABLED}} == false ]]; then
dags_only=0
fi
if [[ ${{steps.deployment-preview.outputs.SKIP_DEPLOY}} == true ]]; then
# skip all deploy steps
dags_only=2
fi
if [[ ${{ inputs.deploy-image }} == true ]]; then
# make sure image and DAGs deploys because deploy-image is true
dags_only=0
fi
echo "DAGS_ONLY=$dags_only" >> $GITHUB_OUTPUT
shell: bash
id: deployment-type
In case anyone else needs a quick fix.
The fix for this has been included in v0.8.0 release, thanks for raising the issue and helping with identifying gaps in the project ❤ 🙇
The Github Action fails if run on a tag push event, even with checkout disabled:
The error seems to be in the script here, because
github.event.before
on a tag resolves to00000....
:https://github.com/astronomer/deploy-action/blob/1c0c1fe1cba39d33a4c30235dca3aa3ea1fa2a7e/action.yaml#L346
We are using the
release-please
plugin to push our DAGs to Prod on the back of a tag push. I will work around this for now with custom shell I guess. Would be good if you can fix.