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

Lighthouse Fix: Access correct commit message for both merges and PRs #1142

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

mmeigs
Copy link
Collaborator

@mmeigs mmeigs commented Jun 20, 2024

Notes:

After recent merge, I realized that accessing the commit message is very different for PRs vs merges to main.

This deals with the differences and ensures that our lighthouse data will have complete and understandable commit messages.

Feel free to contact me with any questions! This took a long time to figure out. I have a public repo in my name that I have been using to experiment. I can show you action runs, if you'd like.

README updates

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

@mmeigs mmeigs changed the title get correct commit message for both merges and PRs Lighthouse Fix: Access correct commit message for both merges and PRs Jun 20, 2024
response=$(curl --request GET --url 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/commits?page=1&per_page=1000' --header 'Accept: application/vnd.github.v3+json' --header 'Content-Type: application/json')
last_commit_message=$(echo "$response" | jq '.[-1].commit.message')
echo "::set-output name=last_commit_message::$last_commit_message"
if ${{ github.ref != 'refs/heads/main' }} == true; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mmeigs thanks for working on this. I would love a small walkthrough if you don't mind. I am not fully understanding what I am looking at 😆.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure!! It took... an embarrassingly long amount of time for me.

.github/workflows/lighthouse.yml Show resolved Hide resolved
Copy link
Collaborator

@caesarbell caesarbell left a comment

Choose a reason for hiding this comment

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

LGTM - Thank you @mmeigs for the demo. This seems like it is going to be a pretty cool addition to our workflow.

@mmeigs mmeigs merged commit cf7d48a into main Jun 20, 2024
2 of 4 checks passed
@mmeigs mmeigs deleted the fix-lighthouse-action branch June 20, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants