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

[🔥AUDIT🔥] Fix GitHub workflow to check for release PRs #2367

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

jandrade
Copy link
Member

🖍 This is an audit! 🖍

Summary:

There's an issue when a new Release Pull Request is created.

The problem is that one of the workflow job steps is failing because it cannot
find the base commit of the PR and it defaults to 00000000....00 instead.

https://github.com/Khan/wonder-blocks/actions/runs/11937708116/job/33275169358#step:5:23

This has been temporarily solved by pushing an empty commit to the PR branch
which causes the branch/PR to have clean its state and have a base commit.

Possible cause:

My theory is that the PR/branch cannot determine the base commit because of the
way GH configures the COMMIT_SHA for this type of event (creating a PR/branch in
this case).

Last commit on the created branch or tag.

My thinking is that the base commit is not being fetched because the workflow
automatically creates a new branch so there's no commit to compare it to.

For reference: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#create

Solution:

This PR fixes the issue by adding a fetch-depth value to the checkout action in
the CI workflow. This will allow the workflow to fetch all the tags and commits
from the repository, so the base commit can be found.

Issue: XXX-XXXX

Test plan:

Verify that there are no PR check errors the next time the "Release PR" is
created (unfortunately, this is the only way to test these type of changes).

@jandrade jandrade self-assigned this Nov 20, 2024
@jandrade jandrade added the audit PR is using the audit OLC flow label Nov 20, 2024
Copy link

changeset-bot bot commented Nov 20, 2024

🦋 Changeset detected

Latest commit: 2812dac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Nov 20, 2024

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/afraid-buckets-yell.md, .github/workflows/node-ci-lint.yml

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@khan-actions-bot khan-actions-bot requested a review from a team November 20, 2024 18:13
Copy link
Contributor

github-actions bot commented Nov 20, 2024

npm Snapshot: NOT Published

🤕 Oh noes!! We couldn't find any changesets in this PR (29963b8). As a result, we did not publish an npm snapshot for you.

Copy link
Contributor

github-actions bot commented Nov 20, 2024

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-xcvlprkkfu.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 0
Tests with visual changes 0
Total stories 503
Inherited (not captured) snapshots [TurboSnap] 369
Tests on the build 369

Copy link
Contributor

github-actions bot commented Nov 20, 2024

Size Change: 0 B

Total Size: 101 kB

ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3.78 kB
packages/wonder-blocks-banner/dist/es/index.js 1.53 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.77 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 887 B
packages/wonder-blocks-button/dist/es/index.js 4.04 kB
packages/wonder-blocks-cell/dist/es/index.js 2.01 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.06 kB
packages/wonder-blocks-core/dist/es/index.js 3.44 kB
packages/wonder-blocks-data/dist/es/index.js 6.24 kB
packages/wonder-blocks-dropdown/dist/es/index.js 18.2 kB
packages/wonder-blocks-form/dist/es/index.js 6.28 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-i18n/dist/es/index.js 4.76 kB
packages/wonder-blocks-icon-button/dist/es/index.js 3 kB
packages/wonder-blocks-icon/dist/es/index.js 871 B
packages/wonder-blocks-labeled-field/dist/es/index.js 72 B
packages/wonder-blocks-layout/dist/es/index.js 1.82 kB
packages/wonder-blocks-link/dist/es/index.js 2.28 kB
packages/wonder-blocks-modal/dist/es/index.js 5.36 kB
packages/wonder-blocks-pill/dist/es/index.js 1.65 kB
packages/wonder-blocks-popover/dist/es/index.js 4.87 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.52 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.3 kB
packages/wonder-blocks-switch/dist/es/index.js 1.94 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.74 kB
packages/wonder-blocks-testing/dist/es/index.js 1.07 kB
packages/wonder-blocks-theming/dist/es/index.js 693 B
packages/wonder-blocks-timing/dist/es/index.js 1.8 kB
packages/wonder-blocks-tokens/dist/es/index.js 2.36 kB
packages/wonder-blocks-toolbar/dist/es/index.js 905 B
packages/wonder-blocks-tooltip/dist/es/index.js 7.08 kB
packages/wonder-blocks-typography/dist/es/index.js 1.23 kB

compressed-size-action

Copy link
Member

@beaesguerra beaesguerra left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for investigating!

To test if it works sooner, we could add an empty changeset using yarn changeset --empty so that when this PR gets merged, a changeset release PR is opened!

@jandrade jandrade merged commit 951105d into main Nov 20, 2024
14 checks passed
@jandrade jandrade deleted the fix-release-pr-check branch November 20, 2024 20:05
@jandrade
Copy link
Member Author

@beaesguerra thanks for the suggestion, but I now remember that creating empty changesets won't generate a new release PR. It was still worth trying :).

https://github.com/Khan/wonder-blocks/actions/runs/11940885877/job/33284531353#step:5:14

@beaesguerra
Copy link
Member

@jandrade ah good to know, thanks for trying it out!

@marcysutton
Copy link
Member

Looks like Changeset PRs are still failing: https://github.com/Khan/wonder-blocks/actions/runs/11977720772/job/33397027198?pr=2368

@jandrade
Copy link
Member Author

Looks like Changeset PRs are still failing: https://github.com/Khan/wonder-blocks/actions/runs/11977720772/job/33397027198?pr=2368

@marcysutton yeah :(. I have another theory and it might be an issue with the get-changed-files custom action that seems to have an issue with reusable workflows. I'll try another solution later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit PR is using the audit OLC flow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants