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 Github Actions script that synchronizes the template every month. #56

Merged
merged 32 commits into from
Sep 8, 2024

Conversation

zyrafal
Copy link
Contributor

@zyrafal zyrafal commented Aug 20, 2024

Resolves #54

The script is located in .github/workflows/sync.yml and it synchronizes the template at 0:00 UTC the 1st day of every month.

I cloned a branch called "test/cd", which was 128 commits behind the "development" branch, into a new branch called "testing", and then I successfuly ran the script on it, proving that it works.

@zyrafal zyrafal mentioned this pull request Aug 20, 2024
@0x4007
Copy link
Member

0x4007 commented Aug 21, 2024

Can you show your test branch results? Once you proved this works, the second part of the task is to update all of the recently updated repositories with the script as well.

@ubiquity-os-deployer
Copy link

ubiquity-os-deployer bot commented Aug 21, 2024

@gentlementlegen
Copy link
Member

gentlementlegen commented Aug 21, 2024

Doesn't this directly merge in the content instead of opening a pull-request? I think it would be less error prone to open a PR against the repo instead of directly merging the changes, so we can double check before they get in the repo, which is also in the spec.

.github/workflows/sync.yml Outdated Show resolved Hide resolved
@zyrafal
Copy link
Contributor Author

zyrafal commented Aug 21, 2024

Okay, the sync.yml script now creates a pull request.

Here is a pull request on the "testing" branch cloned from "test/cd": https://github.com/zyrafal/ts-template/pull/1

And on the "testing-2" branch I merged the pull request: https://github.com/zyrafal/ts-template/tree/testing-2

However, I haven't yet managed to get the other script to work, I'm still working on it.

@zyrafal
Copy link
Contributor Author

zyrafal commented Aug 21, 2024

I didn't manage to get the script that adds it to every repo working as a Github Action, but it works when you run it in shell:

git clone https://github.com/zyrafal/ts-template
cd ts-template/

sync_path=$(realpath .github/workflows/sync-template.yml)
original_remote=$(git remote get-url origin)
# repos=$(gh repo list ubiquity --limit 1 --json name,updatedAt -q '.[] | select(.updatedAt > (now - 30*24*60*60)) | .name')
repos=work.ubq.fi pay.ubq.fi ubiquibot-logger devpool-directory onboard.ubq.fi rpc-handler ubiquibot-telegram ubiquibot-kernel uusd.ubq.fi ubiquity-dollar safe.ubq.fi cloudflare-deploy-action series-a webauthn-evm-signing-key .github ubq.fi ubiquibot leaderboard.ubq.fi uad-contracts business-development keygen.ubq.fi audit.ubq.fi ubiquibot-logging test-cf-deploy hackbar research recruiting faucet card-issuance nft-rewards github-labels-processor scraper-kernel foundry-storage-check foundry-storage-check-nonfork ubiquibar config-hunter sponsorships action-conventional-commits gnosischain.world devpool-directory-bounties uniswap-v3-liquidity-provider-indicator tiny-bonds ubiquiverse-landing-page ubiquity-instadapp the-ubiquity-stick dsa-connect assembly simple-bond dsa-resolvers dsa-connectors olympus-contracts launch-party vfat-tools land-dao-admin-ui nft-contracts web3-ui-dynamic uad-ui-prototyping uad-debt-contracts-prototyping uad-bonding-contracts-prototyping uad-common-contracts-prototyping
for REPO in $repos; do
	gh repo fork --clone ubiquity/$repo
	cd $repo
	mkdir -p .github/workflows
	cp $sync_path .github/workflows/sync-template.yml
	git add .github/workflows/sync-template.yml
	git commit -m "Add sync-template.yml workflow"
	git push
	gh pr create --title "Add sync-template.yml workflow that synchronizes the template every month" --body "Details: https://github.com/ubiquity/ts-template/issues/54" --base development
        cd ..
        rm -rf $repo

Also, I created a new repository with the template and successfuly ran the sync script there (though there were no changes that needed to by synced): https://github.com/zyrafal/test-repo/pull/1

Copy link
Member

Choose a reason for hiding this comment

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

Could we rename this to sync-template.yml for clarity?

@gentlementlegen
Copy link
Member

gentlementlegen commented Aug 28, 2024

@zyrafal I tried on my own org, and it seems to crash if there are conflicts during the process, see the logs. Maybe creating an orphan branch would solve this problem.

@zyrafal
Copy link
Contributor Author

zyrafal commented Aug 30, 2024

Okay, I think it works now.

@gentlementlegen
Copy link
Member

The workflow seemed to work: Meniole/command-start-stop#11

It just doesn't seem super easy to use because I would have many files to delete, since the template covers a lot of cases. I Wonder if we could add some configuration values to ignore certain files (the README for example) dynamically.

Co-authored-by: Mentlegen <9807008+gentlementlegen@users.noreply.github.com>
@0x4007
Copy link
Member

0x4007 commented Sep 1, 2024

The workflow seemed to work: Meniole/command-start-stop#11

Can you get it to auth as our bot like in our other ci

@zyrafal
Copy link
Contributor Author

zyrafal commented Sep 4, 2024

Done.

@gentlementlegen
Copy link
Member

The workflow seemed to work: Meniole/command-start-stop#11

Can you get it to auth as our bot like in our other ci

This requires every repo to have our credentials stored because this comes from an automated workflow and doesn't get the credentials from the kernel, I don't think that's very practical.

@0x4007
Copy link
Member

0x4007 commented Sep 8, 2024

Every repo has our credentials stored. It's an org secret.

@0x4007
Copy link
Member

0x4007 commented Sep 8, 2024

Before accepting this pull and paying out the reward, please open pulls to the other active repositories as per the spec.

Ensure that they link to the issue so we can track all of them. Thank you!

@0x4007 0x4007 merged commit d08a54e into ubiquity:development Sep 8, 2024
3 checks passed
@rndquu rndquu mentioned this pull request Oct 4, 2024
0x4007 added a commit that referenced this pull request Oct 22, 2024
@0x4007 0x4007 mentioned this pull request Oct 22, 2024
0x4007 added a commit that referenced this pull request Oct 22, 2024
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 monthly sync
3 participants