Sync Markdown Files #235
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 Markdown Files | |
on: | |
schedule: | |
- cron: '0 15 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
environment: ScenarioTesting | |
steps: | |
- name: Checkout executable-docs | |
uses: actions/checkout@v2 | |
with: | |
repository: 'MicrosoftDocs/executable-docs' | |
token: ${{ secrets.PAT }} # This line is added | |
- name: 'Az CLI login' | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Setup Python environment | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install --quiet PyGithub pyyaml | |
- name: Set git identity | |
run: | | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --global user.name "${{ github.actor }}" | |
- name: Sync markdown files | |
run: python .github/workflows/sync.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} # Replace with the name of your secret | |
USER_AGENT: ${{ github.actor }} | |
- name: Check for changes | |
id: git-check | |
run: echo "::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo 'false'; else echo 'true'; fi)" | |
- name: Commit and push changes | |
run: | | |
git add . | |
git commit -m "Synced executable docs, updated their metadata, and ran IE tests" | |
git push | |
if: steps.git-check.outputs.modified == 'true' |