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

Update ComposerLockDiff workflow to run without DDEV and use a sticky pull request comment #538

Closed
wants to merge 17 commits into from

Conversation

davereid
Copy link
Member

@davereid davereid commented Apr 22, 2024

Fixes #332

Improvements:

Testing PR:
Lullabot/drainpipe-test#11

Run compares:

@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 19:42 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 19:51 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 19:56 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 20:04 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 20:10 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 20:14 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 20:22 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 22, 2024 20:25 Destroyed
@davereid davereid force-pushed the composer-lock-diff-sticky-pr-comment branch from 041e722 to f848a2d Compare April 23, 2024 15:00
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 23, 2024 15:03 Destroyed
@davereid davereid self-assigned this Apr 23, 2024
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 24, 2024 15:48 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 24, 2024 16:10 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 24, 2024 16:27 Destroyed
@Lullabot Lullabot deleted a comment from github-actions bot Apr 24, 2024
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 24, 2024 16:49 Destroyed
@davereid davereid marked this pull request as ready for review April 24, 2024 16:58
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 24, 2024 17:15 Destroyed
Comment on lines +34 to +40
- name: Generate composer diff
if: ${{ steps.composer-lock-changed.outputs.any_changed == 'true' }}
id: composer-diff
uses: IonBazan/composer-diff-action@v1
with:
with-platform: true
with-links: true
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to also include the underlying CLI command in ddev via a Dockerfile? That way, developers are one step closer to debugging things when they go wrong.

Copy link
Member Author

@davereid davereid Apr 25, 2024

Choose a reason for hiding this comment

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

I don't really think so, and I would actually advocate for removing composer-lock-diff as a task/command. I never found a need for it to run this locally in the same way that it does with the action. I could just always debug the action itself or report an issue upstream with the community action.

It is worth noting this is a change from using https://github.com/davidrjonas/composer-lock-diff to https://github.com/IonBazan/composer-diff. There are more benefits to this change relating to maintained code and Github Actions support:

composer-lock-diff composer-diff
Run composer-lock-diff Run composer diff (composer plugin)
Last release Mar 2022 Last release Apr 2024
No GitHub action available Maintained GitHub action available
Supports Drupal.org diffs Supports Drupal.org diffs now (see IonBazan/composer-diff#24)

That said, having just the composer diff command available from the Dockerfile was useful, but I don't think it needs to be a downloaded binary and task at all since it would be available as a native composer command.

@github-actions github-actions bot temporarily deployed to pantheon-pr-538 April 26, 2024 14:47 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-538 May 1, 2024 16:09 Destroyed
@deviantintegral
Copy link
Member

@beto-aveiga is going to review this for #318 (comment) and if there's overlap file a PR against this branch.

@YesCT
Copy link
Contributor

YesCT commented Jun 10, 2024

We discussed this in the drainpipe sync today. I'd kinda like to see the performance improvement (to not use ddev) and the functional improvement of posting NOT in the description be separate PRs.

[Lullabot internal link to a sample action.]

@mrdavidburns mrdavidburns assigned beto-aveiga and unassigned davereid Jul 11, 2024
@mrdavidburns
Copy link
Member

@beto-aveiga is going to code review and test this branch out on an existing project to determine time saved.

@github-actions github-actions bot temporarily deployed to pantheon-pr-538 July 16, 2024 12:57 Destroyed
- uses: actions/cache@v4
- name: Check if composer.lock was changed
id: composer-lock-changed
uses: tj-actions/changed-files@v44
Copy link
Member

Choose a reason for hiding this comment

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

@deviantintegral suggests that we pin to a commit hash so future releases don't unexpectedly break our builds.

- name: Install and Start DDEV
uses: ./.github/actions/drainpipe/ddev
- name: Delete sticky pull request comment
uses: marocchino/sticky-pull-request-comment@v2
Copy link
Member

Choose a reason for hiding this comment

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

@deviantintegral suggests that we pin to a commit hash so future releases don't unexpectedly break our builds.

- name: Generate composer diff
if: ${{ steps.composer-lock-changed.outputs.any_changed == 'true' }}
id: composer-diff
uses: IonBazan/composer-diff-action@v1
Copy link
Member

Choose a reason for hiding this comment

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

@deviantintegral suggests that we pin to a commit hash so future releases don't unexpectedly break our builds.

-d @processed.json
- name: Post sticky pull request comment
if: ${{ steps.composer-lock-changed.outputs.any_changed == 'true' }}
uses: marocchino/sticky-pull-request-comment@v2
Copy link
Member

Choose a reason for hiding this comment

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

@deviantintegral suggests that we pin to a commit hash so future releases don't unexpectedly break our builds.

Copy link
Contributor

Choose a reason for hiding this comment

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

How do we get notified of new releases to update the hash to? Monitor the log files for deprecation notices?

Copy link
Member Author

@davereid davereid Aug 5, 2024

Choose a reason for hiding this comment

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

While I agree that locking it down to commit hashes is better for security, the problem becomes when we need to update the workflows to all the consumers, or any repositories haven't been updated in a while, their actions could potentially break due to GitHub changes. It's a trade-off that we can balance with only doing it for very specific, trusted actions.

@mrdavidburns
Copy link
Member

@beto-aveiga Instead of pulling this out of DDEV, we discussed bundling it in with the Static Tests which does use DDEV but we're no longer having to wait for another job to build that container since it's already available.

@davereid
Copy link
Member Author

davereid commented Aug 5, 2024

I'm not sure that bundling it is a wise idea, if static tests fail, or DDEV fails to spin up, we run into the same problem where PRs won't have their diffs posted, which can still be very helpful information to review on a PR while broken jobs get resolved.

@justafish justafish closed this Aug 16, 2024
@justafish justafish deleted the composer-lock-diff-sticky-pr-comment branch August 16, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants