Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(surge-deploy): get artifact from the specific workflow run #744

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

tbouffard
Copy link
Member

Previously, this wasn't set in dawidd6/action-download-artifact so the
action was doing a search to retrieve the artifact.
It was using default search parameters, so it skip workflow runs for PR
from forks, and always considered the latest run of the workflow.
So, when several PR was opened simultaneously, a wrong artifact could be
retrieved.

In addition, don't run the deployment workflow if the build step failed.
Fix the fix, the deployment would fail because no artifact is available for download.

Notes

Fixes #741
Validated with process-analytics/github-actions-playground#363 (comment)

About the addition of a condition to run the workflow

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow

A workflow run is triggered regardless of the conclusion of the previous workflow. If you want to run a job or step based on the result of the triggering workflow, you can use a conditional with the github.event.workflow_run.conclusion property.

tbouffard added 3 commits July 4, 2024 14:25
Previously, this wasn't set in `dawidd6/action-download-artifact` so the
action was doing a search to retrieve the artifact.
It was using default search parameters, so it skip workflow runs for PR
from forks, and always considered the latest run of the workflow.
So, when several PR was opened simultaneously, a wrong artifact could be
retrieved.

In addition, don't run the deployment workflow if the build step failed.
Fix the fix, the deployment would fail because no artifact is available for download.
Copy link

sonarqubecloud bot commented Jul 4, 2024

@bonita-ci
Copy link
Contributor

bonita-ci commented Jul 4, 2024

🎊 PR Preview 02d7519 has been successfully built and deployed to https://bonitasoft-bonita-documentation-site-test-pr-744.surge.sh

🕐 Build time: 0.01s

🤖 By surge-preview

@bonita-ci
Copy link
Contributor

bonita-ci commented Jul 4, 2024

🎊 PR Preview 02d7519 has been successfully built and deployed to https://bonitasoft-bonita-documentation-site-deploy-pr-744.surge.sh

🕐 Build time: 0.009s

🤖 By surge-preview

Copy link
Contributor

@benjaminParisel benjaminParisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done 👏

@@ -13,12 +13,14 @@ jobs:
# IMPORTANT: the logic is duplicated in the `surge-deploy-pr-preview-test.yml` workflow. Keep both definitions in sync.
deploy:
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: we already did that in the workflow we used to validate the solution but miss it here (probably a mistake)
See https://github.com/process-analytics/github-actions-playground/blob/56add9dacc916c898c609fbe480bd7ceb2ba353c/.github/workflows/surge-pr-fork-02-deploy.yml#L15-L17

@tbouffard tbouffard merged commit c3dcaa5 into master Jul 4, 2024
5 checks passed
@tbouffard tbouffard deleted the ci/fix_wf_surge_deploy branch July 4, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The PR preview on surge is displaying the content of another PR
3 participants