Reputation: 367
name: deploy-me
on: [push]
jobs:
deploys-me:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: npm run dev
//Next I want to copy some file from this repo and commit to a different repo and push it
This is my workflow.yaml file,
After npm run dev
, I want to be able to copy a file to another directory, commit and push to that another repo
Upvotes: 10
Views: 7428
Reputation: 367
name: deploy-me
'on':
- push
jobs:
deploy-me:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
env:
ACCESS_TOKEN: '${{ secrets.ACCESS_TOKEN }}'
- run: npm install
- run: npm run build
- run: |
cd lib
git config --global user.email "[email protected]"
git config --global user.name "aliasifk"
git config --global credential.helper cache
git clone https://${{secrets.ACCESS_TOKEN}}@github.com/aliasifk/xxxxxx
cp index.js clonedFolder/ -f
cd clonedFolder
git add .
git commit -m "$(date)"
git push
This is how I fixed my problem,
I created a Personal Access Token from my developer settings
and copied it for later step.
I added ACCESS_TOKEN
environment variable by navigating to my repository settings and adding a secret. Here I pasted the previously created access token.
Then simply that code and using secrets
context to access that token, note that name is similar to the one we created before
Happy Hacking!
Upvotes: 7