Enable Dependabot #17163
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
# Enable Dependabot for all forked repos | |
name: Enable Dependabot | |
on: | |
push: | |
paths: | |
- .github/workflows/dependabot-updates.yml | |
- .github/workflows/dependabot-updates.ps1 | |
schedule: | |
#- cron: '*/60 * * * *' | |
- cron: '40 */1 * * *' | |
workflow_dispatch: | |
env: | |
numberOfReposToDo: 1000 | |
numberOfReposToDoRepoInfo: 100 | |
jobs: | |
enable-em-all: | |
concurrency: there-can-be-only-one | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get current actions list | |
run: | | |
curl "${{ secrets.BLOB_SAS_TOKEN }}" > actions.json | |
- name: Get App Token | |
id: get_workflow_token | |
uses: rajbos-actions/[email protected] | |
with: | |
application_id: 264650 | |
application_private_key: ${{ secrets.Automation_App_Key }} | |
organization: actions-marketplace-validations | |
- shell: pwsh | |
name: Gotta enable 'em all | |
run: | | |
$existingForks=(cat status.json | ConvertFrom-Json) | |
Write-Host "Found [$($existingForks.Length)] actions in the status file" | |
Install-Module -Name PSGraphQL -Repository PSGallery -Scope CurrentUser -Allowclobber -Force | |
Install-Module -name powershell-yaml -Force -Repository PSGallery -Scope CurrentUser -Allowclobber | |
# fork repos and load Dependabot status | |
# this started to fail with the PAT ./.github/workflows/dependabot-updates.ps1 -actions $existingForks -numberOfReposToDo ${{ env.numberOfReposToDo }} -access_token "${{ secrets.ACCESS_TOKEN }}" -access_token_destination "${{ steps.get_workflow_token.outputs.token }}" | |
./.github/workflows/dependabot-updates.ps1 -actions $existingForks -numberOfReposToDo ${{ env.numberOfReposToDo }} -access_token "${{ steps.get_workflow_token.outputs.token }}" -access_token_destination "${{ steps.get_workflow_token.outputs.token }}" | |
- name: Commit changes | |
if: always() | |
run: | | |
# pull to make sure we have the latest contents and that the commit / push will succeed | |
# still fails if these two files have been updated ofc. | |
git pull --quiet | |
if [[ `git status --porcelain` ]]; then | |
git config --global user.email "[email protected]" | |
git config --global user.name "GITHUB_TOKEN" | |
git add status.json | |
git add failedForks.json | |
git commit -m "Update status.json" | |
git push | |
else | |
echo "Nothing to commit" | |
fi |