Skip to content

Make sure the build step runs at least once, when the PR is opened.#753

Merged
carstingaxion merged 1 commit intoGatherPress:mainfrom
carstingaxion:fix/playground-preview-run-build-on-pr-opening
Aug 2, 2024
Merged

Make sure the build step runs at least once, when the PR is opened.#753
carstingaxion merged 1 commit intoGatherPress:mainfrom
carstingaxion:fix/playground-preview-run-build-on-pr-opening

Conversation

@carstingaxion
Copy link
Copy Markdown
Collaborator

@carstingaxion carstingaxion commented Aug 2, 2024

When the playground-preview workflow is triggered and never will run the build step, because all changes were made to other (than the workflow triggering) files, nothing is uploaded as artifact and so the comment step would output a non-working playground link.

Description of the Change

This PR makes sure the build step runs at least once, when the PR is opened.

Closes # Testing & Clean-up after #666, #741, #749 & #750

How to test the Change

  1. Test that it NOT runs
    1. Open a PR
    2. ...with changes to .github/... or .wordpress-org/...
    3. See that the whole workflow is NOT triggered.
  2. Test that it runs 1/2
    1. Open a PR
    2. ... with changes to src/...
    3. See that the workflow is triggered & the build step runs succesfully.
  3. Test that it runs 2/2
    1. Open a PR
    2. ... with changes to includes/...
    3. See that the workflow is triggered & the build step runs succesfully.
  4. Test that it updates the comment 1/2
    1. In one of the opened PRs
    2. ... do some changes to src/...
    3. See that the build step runs succesfully & the comment is updated.
  5. Test that it updates the comment 2/2
    1. In one of the opened PRs
    2. ... do some changes to includes/...
    3. See that the build step is skipped & the comment is updated.

Changelog Entry

Changed - Restrict workflow to only run when needed, for the 🌳 🌳 🌳

Credits

Props @carstingaxion

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@what-the-diff
Copy link
Copy Markdown

what-the-diff bot commented Aug 2, 2024

PR Summary

  • Updated Workflow File
    The .github/workflows/playground-preview.yml has been adjusted for improved code management.

  • Job Name Modification
    The job previously named check-changes was renamed to needs-build for better clarity.

  • Reformed Outputs Section
    Under the needs-build section, the key src_changed got replaced by run_build. This aims at enhancing the understanding of the code.

  • Condition Adjustment in 'zip' and 'comment' Jobs
    The if condition clause in both the zip and comment jobs have been refined. They now rely on the needs-build output instead of the obsolete check-changes.

  • Script Update for 'run_build' Variable
    The script that sets the run_build variable has been matured. Before, it just checked for changes in the /src/ directory. With this update, the pull request is evaluated to see if it has just been opened alongside changes in the /src/ directory.

  • Variable Renaming
    To maintain consistency and readability in the code, the variable src_changed was renamed to run_build.

@carstingaxion carstingaxion marked this pull request as ready for review August 2, 2024 16:16
@carstingaxion carstingaxion merged commit fd21c7d into GatherPress:main Aug 2, 2024
carstingaxion added a commit to carstingaxion/gatherpress that referenced this pull request Aug 2, 2024
carstingaxion added a commit to carstingaxion/gatherpress that referenced this pull request Aug 2, 2024
carstingaxion added a commit to carstingaxion/gatherpress that referenced this pull request Aug 2, 2024
carstingaxion added a commit to carstingaxion/gatherpress that referenced this pull request Aug 2, 2024
@carstingaxion carstingaxion deleted the fix/playground-preview-run-build-on-pr-opening branch August 13, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant