This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Submodule in Codercops Site | |
on: | |
push: | |
branches: | |
- main # Change to your default branch name if it's different | |
jobs: | |
update-submodule: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codercops-site Repo | |
uses: actions/checkout@v3 | |
with: | |
repository: anurag629/codercops-site # Replace with your GitHub username and repo name | |
token: ${{ secrets.GIT_TOKEN }} | |
path: codercops-site | |
- name: Checkout Codercops Site Repo | |
uses: actions/checkout@v3 | |
with: | |
repository: anurag629/codercops-site # Use the correct username/repo for the private repo | |
token: ${{ secrets.GIT_TOKEN }} | |
path: codercops-site | |
submodules: recursive # Ensure submodules are initialized | |
- name: Configure Git | |
run: | | |
git config --global user.email ${{ secrets.PERSONAL_EMAIL }} # Replace with your email | |
git config --global user.name "anurag629" # Replace with your name | |
- name: Update Submodule | |
run: | | |
cd codercops-site | |
git submodule update --remote | |
git status | |
if [ -n "$(git status --porcelain)" ]; then | |
git add path-to-content # Ensure you add the submodule path specifically | |
git commit -m "Update submodule to codercops-content commit ${{ env.commit_hash }}" | |
git push origin main # Change to your branch name if needed | |
else | |
echo "Submodule is already up to date." | |
fi |