Skip to content

Commit 2ec874f

Browse files
committed
fix
1 parent 555861e commit 2ec874f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

actions/preview/action.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,25 @@ runs:
1818
- name: Get types
1919
id: type
2020
shell: bash
21-
env:
22-
IS_DEPLOYMENT: ${{ toJSON(github.event_name == 'pull_request' || github.ref == 'refs/heads/main') }}
23-
IS_CLEANUP: ${{ toJSON(github.event_name == 'pull_request_target' && github.event.action == 'closed') }}
2421
run: |
25-
echo "IS_DEPLOYMENT=${IS_DEPLOYMENT}" >> $GITHUB_OUTPUT
26-
echo "IS_CLEANUP=${IS_CLEANUP}" >> $GITHUB_OUTPUT
22+
if [[ "${{ github.event_name}}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
23+
echo "IS_DEPLOYMENT=true" >> $GITHUB_OUTPUT
24+
echo "IS_CLEANUP=false" >> $GITHUB_OUTPUT
25+
else
26+
if [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.action }}" == "closed" ]]; then
27+
echo "IS_CLEANUP=true" >> $GITHUB_OUTPUT
28+
echo "IS_DEPLOYMENT=false" >> $GITHUB_OUTPUT
29+
else
30+
is_deployment=${{ toJSON(github.event_name == 'pull_request' || github.ref == 'refs/heads/main') }}
31+
echo "IS_CLEANUP=false" >> $GITHUB_OUTPUT
32+
echo "IS_DEPLOYMENT=${is_deployment}" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Debug
36+
shell: bash
37+
run: |
38+
echo "IS_DEPLOYMENT: ${{ steps.type.outputs.IS_DEPLOYMENT }}"
39+
echo "IS_CLEANUP: ${{ steps.type.outputs.IS_CLEANUP }}"
2740
2841
- name: Authenticate
2942
uses: elastic/docs-builder/.github/actions/aws-auth@main
@@ -130,7 +143,7 @@ runs:
130143
131144
- name: Update deployment status
132145
uses: actions/github-script@v7
133-
if: always() && steps.type.outputs.IS_DEPLOYMENT == 'true'
146+
if: always() && steps.type.outputs.IS_DEPLOYMENT
134147
with:
135148
script: |
136149
await github.rest.repos.createDeploymentStatus({

0 commit comments

Comments
 (0)