update-microsoft-info #1009
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
# Run daily and when custom data is updated to generate a new csv/json | |
name: update-microsoft-info | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- 'README.md' | |
- '_info/**' | |
pull_request: | |
branches: [ "main" ] | |
# Run twice a day (5.30am and 5.30pm) | |
schedule: | |
- cron: '30 5,17 * * *' | |
# Allows to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Azure AD Workload Identity Federation | |
uses: nicolonsky/WIF@v0.0.1 | |
with: | |
tenant_id: '0817c655-a853-4d8f-9723-3a333b5b9235' | |
client_id: '38535360-9f3e-4b1e-a41e-b4af46afcb0c' | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Generate docs | |
run: | | |
Install-Module -Name Microsoft.Graph.Authentication | |
Install-Module -Name Microsoft.Graph.Applications | |
$token = $env:ACCESS_TOKEN | ConvertTo-SecureString -AsPlainText | |
Connect-MgGraph -AccessToken $token | |
./src/Export-MicrosoftApps.ps1 | |
./src/Export-GraphPermissions.ps1 | |
shell: pwsh | |
- name: Update repo | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
# Changes | |
echo "Updating repo" | |
git config --global user.name 'Merill Fernando' | |
git config --global user.email 'merill@users.noreply.github.com' | |
git commit -am "Daily automation" | |
git push | |
else | |
# No changes | |
echo "No changes" | |
fi |