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

feat: refactor sync template workflow to work in a whitelist setting #78

Open
wants to merge 10 commits into
base: development
Choose a base branch
from

Conversation

zugdev
Copy link
Contributor

@zugdev zugdev commented Nov 8, 2024

Resolves #61

The sync workflow should only propose changes automatically on shared files between repos, I agree those include some of the workflows and ts settings. What I would propose is to enable manual workflow runs with input files too. This way if you want every repo that uses the template to receive a specific new file or to create an overwriting, but not too big PR, you can do it. I believe the AI analysis even though might help, would still need a thorough review and would not reduce any time overhead. I am not sure centralizing the sync workflow is a good idea, if so we would need another way to identify which repos implement the template, to only open PRs in those. If it is really needed we can have a repos list in the workflow, but I think having the sync template in this repo and skipping when it runs here is sufficient to deliver updates to all sync-template workflows across our implementations.

  1. Whitelist approach
  2. Allow for inputting specific files and running manually
  3. Adds sync-template to this repo and skips runs in ts-template

@zugdev zugdev marked this pull request as draft November 8, 2024 20:27
@ubiquity-os-deployer
Copy link

ubiquity-os-deployer bot commented Nov 8, 2024

@zugdev
Copy link
Contributor Author

zugdev commented Nov 8, 2024

Here is a QA, though it's failed because I don't have auth setup, you can see through the logs the modified files:

1. can create files with whitelist

2. can create files with additional manual input

3. can delete files

4. can modify files

@zugdev zugdev marked this pull request as ready for review November 8, 2024 22:23
- name: Sync branch to template
env:
GH_TOKEN: ${{ steps.get_installation_token.outputs.token }}
WHITELIST_FILES: ".github/workflows/build.yml tsconfig.json"
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be a much longer list

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a demo only

env:
GH_TOKEN: ${{ steps.get_installation_token.outputs.token }}
WHITELIST_FILES: ".github/workflows/build.yml tsconfig.json"
ADDITIONAL_FILES: ${{ github.event.inputs.additional_files }}
Copy link
Member

Choose a reason for hiding this comment

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

Is this a list? How exactly is this defined? What's the value in your qa

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 example in this QA, I dispatched with the following inputs: .eslintrc,.prettierrc,.github/

image

With the intention of synchronizing .eslintrc, .prettierrc and the entire .github/ directory, you can see it works as intended:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll improve the description, it's a little bit confusing

@zugdev
Copy link
Contributor Author

zugdev commented Nov 10, 2024

My solution enables individual repo configuration, the whitelist for this repo's sync-template.yml doesn't matter. What we should do is evaluate what files are shared between implementation and template and add it to the workflow in that specific implementation's repo. For example: in work.ubq.fi I know that the template's build workflow will work, so I should add it to the whitelist, on the other hand deploy.yml won't work - since we are implementing a KV setup. Another feature I've enabled is the manual synchronization with custom extra inputs, so:

  1. If you want to sync the whitelisted files/directories with the template at any time you can manually do that with empty arguments

  2. If you want to sync files/directories that aren't in the whitelist you can manually do that with paths separated by commas

Therefore a second step to this PR, is opening PRs in repos that implement ts-template with an initial configuration. I'll get started on that. It seems there a billion repos, what I could do to speed up is to initially setup the very obvious common files such as the .husky directory, and then with use we expand each repo's whitelist.

Copy link

ubiquity-os bot commented Nov 14, 2024

@zugdev, this task has been idle for a while. Please provide an update.

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.

Automatic sync v2
2 participants