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

Add a dispatchable workflow to run yarn fix #2403

Merged
merged 3 commits into from
Apr 13, 2023
Merged

Conversation

TimDiekmann
Copy link
Member

@TimDiekmann TimDiekmann commented Apr 12, 2023

🌟 What is the purpose of this PR?

This adds a workflow which is dispatchable and should be able to fix any auto-fixable lints (like prettier).

🔗 Related links

🚫 Blocked by

🚀 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)
  • modifies a Cargo-publishable library and I have amended the version
  • modifies a Cargo-publishable library, but it is not yet ready to publish
  • modifies a block that will need publishing via GitHub action once merged
  • does not modify any publishable blocks or libraries
  • I am unsure / need advice

⚠️ Known issues

I'm currently not able to test it as

To trigger the workflow_dispatch event, your workflow must be in the default branch

🐾 Next steps

Test this workflow when this PR has been merged

@github-actions github-actions bot added the area/infra Relates to version control, CI, CD or IaC (area) label Apr 12, 2023
Comment on lines +18 to +19
git config user.name github-actions
git config user.email github-actions@github.com
Copy link
Contributor

Choose a reason for hiding this comment

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

No easy way to get the Git of the user triggering the workflow?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can't find anything, the best guess we found is either from getting the most recent commit (might be a different person), or by just getting the name (but then the name is going to be associated with the github-actions email address which seems.. strange).

This seems fine for now

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually just found something else 😅

We do have access to the GITHUB_ACTOR env-var, and could recreate a no-reply email like so:

Note: If you created your account on GitHub.com after July 18, 2017, your noreply email address for GitHub is an ID number and your username in the form of ID+USERNAME@users.noreply.github.com. If you created your account on GitHub.com prior to July 18, 2017, your noreply email address from GitHub is USERNAME@users.noreply.github.com. You can get an ID-based noreply email address for GitHub by selecting (or deselecting and reselecting) Keep my email address private in your email settings.

But I'm not sure if there's a reliable way for us to find which email to use, (i.e. the ID+USERNAME format or just the USERNAME one), and I can't find an API to get a public email from a user. While it may work by just guessing at the email, (who knows how GitHub actually associates these things to accounts) it feels like we'd be depending on internal implementation details and it's not really important to know who triggered a yarn fix action 😅

Copy link
Contributor

@Alfred-Mountfield Alfred-Mountfield left a comment

Choose a reason for hiding this comment

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

Let's try it out

@TimDiekmann TimDiekmann added this pull request to the merge queue Apr 13, 2023
@TimDiekmann TimDiekmann removed this pull request from the merge queue due to a manual request Apr 13, 2023
@TimDiekmann TimDiekmann added this pull request to the merge queue Apr 13, 2023
Merged via the queue into main with commit fdbb361 Apr 13, 2023
@TimDiekmann TimDiekmann deleted the td/infra/autofix branch April 13, 2023 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/infra Relates to version control, CI, CD or IaC (area)
Development

Successfully merging this pull request may close these issues.

2 participants