Drupal 7: How to save a node programmatically and add an image field from a public URL
Note: I have public URLs of these images, which I want to save. return…
April 16, 2021
I had to create many repositories in an Github organization. I created an organization, and I had around 40 projects which I need to migrate from perforce to git.
We can repository from Github portal(UI), and it requires at least 6 clicks:
So total of 7+3=10 clicks per project
So, for 40 projects I had to perform 40*10 = 400 clicks
, which was unmanageable.
My requirements are:
I synced those 40 folders to my local directory. Lets call it mylibs_
And, I have a team in github which I will assign permission to these projects.
curl -u USERNAME:TOKEN https://github.com/api/v3/repos/USERNAME/PROJECT/teams
Assumming following folders:
mylibs
mylibs_
AUTH="USERNAME:TOKEN"
for d in *;
do
echo "Working on ${d}"
curl -s -o /dev/null -w "%{http_code}" \
-u ${AUTH} \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://github.com/api/v3/orgs/mylibs/repos \
-d '{"name": "'${d}'", "visibility": "private", "private": "true", "auto_init": "true", "team_id": "TEAM_ID"}'
echo "";
git clone [email protected]:mylibs/${d}.git ../mylibs/${d}
cp -R ${d}/* ../mylibs/${d}/
cd ../mylibs/${d}/
git add .
git commit -m "Migration from P4 to git"
git push
echo ""
echo "Done with ${d}"
cd -
done
Visit github page for How to create oAuth token{:target=“_blank”}
Please note that the repositories created will be with visibility=private
. And the team assigned to each repository will be having readonly access.
Note: I have public URLs of these images, which I want to save. return…
MongoDB CRUD Operations Mongoose provides a simple schema based solution to…
Thanks for reading.
Here, we give exact response from youtube apis.
Introduction I got my seo backlink work done from a freelancer. It was like 300…
Introduction I had to develop a small automation to query some old mysql data…
Introduction This post has the complete code to send email through smtp server…
Introduction In a normal email sending code from python, I’m getting following…
Introduction In one of my app, I was using to talk to . I have used some event…
Introduction So you have a Django project, and want to run it using docker image…
Introduction It is very important to introduce few process so that your code and…
Introduction In this post, we will see a sample Jenkin Pipeline Groovy script…