Skip to content

Check for updates for all forks #758

Check for updates for all forks

Check for updates for all forks #758

name: Check for updates for all forks
on:
push:
branches:
- main
schedule:
- cron: 7 0 * * 1-5
workflow_dispatch:
jobs:
check-for-updates:
runs-on: ubuntu-latest
outputs:
update: ${{steps.update_step.outputs.update}}
steps:
- uses: peter-murray/workflow-application-token-action@8e4e6fbf6fcc8a272781d97597969d21b3812974 # v2.1.0
name: Get token from GitHub App
if: ${{ vars.USE_GITHUB_APP == 'true' }}
id: get-workflow-token
with:
application_id: ${{ secrets.GH_AUTOMATION_ID }}
application_private_key: ${{ secrets.GH_AUTOMATION_PRIVATE_KEY }}
- id: get-token
name: Determine token to use
env:
github_app_token: ${{ steps.get-workflow-token.outputs.token }}
PAT_GITHUB: ${{ secrets.PAT_GITHUB }}
run: |
if [ -n "$github_app_token" ]; then
echo "token=$github_app_token" >> $GITHUB_OUTPUT
echo "Using token from GitHub App"
else
echo "token=$PAT_GITHUB" >> $GITHUB_OUTPUT
echo "Using personal access token from secret 'PAT_GITHUB'"
fi
- uses: actions/checkout@v4
- id: update_step
shell: pwsh
name: Check for updates
run: |
$updateResult = (.\updater.ps1 -orgName ${{ github.repository_owner }} -userName "xxx" -PAT ${{ steps.get-token.outputs.token }} -issuesRepository ${{ github.repository }} )
if ($null -ne $updateResult) {
$reposWithUpdates = $updateResult[-1]
Write-Host "Are there any updates available? [$($reposWithUpdates.Count -gt 0)]"
echo "update=$($reposWithUpdates.Count -gt 0)" >> $env:GITHUB_OUTPUT
}