Updated GitHub workflows (#386) #52
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: Sync to Azure DevOps | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout GitHub repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # This is necessary | |
- name: Set up Git configuration | |
run: | | |
git config --global user.name "HotCakeX" | |
git config --global user.email "[email protected]" | |
- name: Sync main branch to Azure DevOps | |
env: | |
AZURE_REPO_URL: https://[email protected]/SpyNetGirl/Harden-Windows-Security/_git/Harden-Windows-Security | |
AZURE_DEVOPS_PAT: ${{ secrets.AZUREDEVOPSPATFORSYNC }} | |
run: | | |
# Adding Azure DevOps repo as a remote | |
git remote add azure "$AZURE_REPO_URL" | |
git remote -v # Verifying the remote was added | |
# Authenticating with Azure DevOps using PAT | |
git config --global credential.helper store | |
echo "https://SpyNetGirl:${AZURE_DEVOPS_PAT}@dev.azure.com" > ~/.git-credentials | |
# Pushing only the main branch to Azure DevOps | |
# The 2 repositories will be completely identical and any discrepancy is taken care of by force push | |
git push azure main --force |