Closed ReenigneArcher closed 1 year ago
Hehe, good timing. You created this issue 8 days ago, and I was writing about it 6 days ago https://github.com/asyncapi/.github/issues/199#issuecomment-1333965439 😆
So yeah, this action does not support removal. It has simple behavior, copies changes to files (new or edits), and pastes in give repo where things need to be replicated.
I was thinking of modifying the code to also support the removal of files by basically detecting that file was deleted so it must be removed form the destination folder. But...but recently I had a use case when I had to remove a workflow file from 55 repos out of 62 and luckily found a contributor willing to do clean up. I could not remove the original workflow from .github
as it was replicated to the remaining repos.
I love the idea with patterns_to_remove
we could have:
- name: Replicating file
uses: derberg/copy-files-to-other-repositories@v1.0.0
with:
github_token: ${{ secrets.GH_TOKEN }}
patterns_to_remove: .github/workflows/if-go-pr-testing.yml
topics_to_include: nodejs
committer_username: asyncapi-bot
committer_email: info@asyncapi.io
commit_message: "ci: remove workflows for go projects"
so Go-related .github/workflows/if-go-pr-testing.yml
would be removed from all repos that have nodejs
topic.
now only question is how patterns_to_remove
will play with destination
If I say
patterns_to_remove: globalworkflows/if-go-pr-testing.yml
destination: .github/workflows/if-go-pr-testing.yml
then if-go-pr-testing.yml
is looked for only in .github/workflows/if-go-pr-testing.yml
location, otherwise globalworkflows/if-go-pr-testing.yml
Also, my assumption is that patterns_to_include
and patterns_to_remove
are mutually exclusive
pinging other contributors for opinion as they might also be interested in this solution
I would keep the settings the same and introduce no additional settings. When a file is removed (assuming the delete file is included in patterns_to_include) in the source repo, I would expect that it's also removed in the destination repo's. It seems like the natural behaviour.
I actually think we need 2 different solutions:
When a file is removed (assuming the delete file is included in patterns_to_include) in the source repo, I would expect that it's also removed in the destination repo's. It seems like the natural behaviour.
because like @Tjitse-E wrote, it basically feels natural.github
. Like I described above, I have use case that workflow was pushed to 40 repos, but now we decided it should be just in 5 repos, so I do not want to remove it from .github
, so having patterns_to_remove
is necessaryLooks like another action name change is approaching. Name copy-files-to-other-repositories
is no longer valid.
Any suggestions?
manage-files-across-repositories
or manage-same-files-across-many-repositories
Any suggestions?
global-file-manager
I would have made a discussion on this, but it's not enabled for this repo so thought I'd share here. Did you guys see this new feature being rolled out on GitHub? https://github.blog/changelog/2023-01-10-github-actions-support-for-organization-wide-required-workflows-public-beta/
I don't think it replaces this action completely as I often use it to copy non-workflow files. I've yet to try it but I think it can at least simplify the matrix I'm using for this action.
Edit: These currently only support pull_request
and pull_request_target
workflows, so not really that useful.
I opened a PR to get this done finally https://github.com/derberg/copy-files-to-other-repositories/pull/48
Thank you! Unfortunately I won't be able to test it as I've already manually removed everything and don't have a test org setup.
@ReenigneArcher no worries, thanks for info
v2.1.0 is out but v2
will be created later, once I use this action in my org. Although I hope nobody uses actions through tags like v2
🙏🏼 cause of security concerns and all that shit.
worked well https://github.com/asyncapi/generator/pull/950
workflows with 2 jobs https://github.com/asyncapi/.github/blob/master/.github/workflows/global-remover.yml
normally would create 2 PRs, not just one PR with 2 commits
anyone have time to test before v2
update?
Hi, I finally have another use case for this.
Unfortunately the option being mutually exclusive is really not ideal. That severely complicates my matrix run.
Edit: maybe not that big a deal now that this is in https://github.com/derberg/manage-files-in-multiple-repositories/pull/50
Didn't even realize that got merged... going to try it out.
Reason/Context
Please try answering few of those questions
I am in process of combining two workflow files into one. One of the files will then be deleted. I would assume this action does not currently delete files from the destination repo (please correct me if I'm mistaken).
It would be preferable to have the files to delete specified by this action as I don't want to open additional PRs.
Description
Please try answering few of those questions
You could add a new input
patterns_to_remove
. Then try to delete the file in the destination repo, but don't fail if it doesn't exist.