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

ci: Add tokens PR action #475

Merged
merged 4 commits into from
Dec 4, 2023
Merged

ci: Add tokens PR action #475

merged 4 commits into from
Dec 4, 2023

Conversation

witwash
Copy link
Contributor

@witwash witwash commented Nov 28, 2023

Summary

Added an action that would trigger on push in design-tokens-** branch. This action will create a PR to master.

This action will ensure we have the latest version of tokens from design-tokens. Right now we have an action that is committing new files to design-tokens-${version} branch. This action will create a PR and generate files that were touched by the tokens update.

Testing steps

We'll need to check whether the trigger is working correctly and the PR is created.

Follow-up issues

Set up an action that would regenerate theme_tailor files in this same PR. done

Check during review

  • Verify against Jira issue.
  • Is the PR over 300 additions? Consider rejecting it with advice to split it. Is it over 500 additions? It should definitely be rejected.
  • Unused code removed.
  • Build passing.
  • Is it a bug fix? Check that it is covered by a proper test (unit or integration).

@witwash
Copy link
Contributor Author

witwash commented Nov 29, 2023

@ookami-kb, WDYT? 🤔

@witwash witwash marked this pull request as ready for review December 1, 2023 10:49
@witwash witwash requested a review from a team December 1, 2023 10:49
file_pattern: "*tailor.dart"

- name: Create Pull Request
uses: repo-sync/pull-request@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's rather use GitHub CLI, it's pre-installed on action runners: https://cli.github.com/manual/gh_pr_create

run: melos gen_theme

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a separate action for that? Isn't it just a couple lines of code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For no particular reason tbh. I wrote it with commands at first, then I looked at the action and it felt cleaner

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather avoid using 3rd party actions unless they bring a lot of benefits.


- name: Commit changes
run: |
git config --local user.email "[email protected]"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we have a user that we should use here? In design-tokens repo we use [email protected]

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, this one is fine.

@witwash witwash requested a review from ookami-kb December 4, 2023 09:18
pr_body: "Design Tokens were updated! This PR was created to update the code."
github_token: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create -B master -H ${{ github.ref_name }} --title 'feat: Design Tokens Update' --body 'Design Tokens were updated! This PR was created to update the code.'
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking: use full-sized parameters (--branch, --head)

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I see it's already updated 🤦

@witwash witwash merged commit 96a46d4 into master Dec 4, 2023
5 checks passed
@witwash witwash deleted the tokens-sync-action branch December 4, 2023 12:02
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.

2 participants