Analyze #14289
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
# Fork new action repos | |
# Get new data from Dependabot | |
# Store the data in the repo for later use | |
name: Analyze | |
on: | |
push: | |
paths: | |
- .github/workflows/analyze.yml | |
- .github/workflows/functions.ps1 | |
schedule: | |
#- cron: '*/60 * * * *' | |
- cron: '1 */1 * * *' | |
workflow_dispatch: | |
env: | |
numberOfReposToDo: 100 | |
numberOfReposToDoRepoInfo: 100 | |
jobs: | |
check-em-all: | |
concurrency: there-can-be-only-one | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get current actions list | |
env: | |
SAS: "${{ secrets.BLOB_SAS_TOKEN }}" | |
run: | | |
# extract filename from SAS | |
fileKeySAS=${SAS##*?sv=} | |
echo "File key: [$fileKeySAS]" | |
curl $SAS > actions.json | |
echo "Directory info:" | |
ls -la | |
echo "" | |
echo "Content of the file:" | |
head -n 10 actions.json | |
- name: Get App Token | |
id: get_workflow_token2 | |
uses: rajbos-actions/[email protected] | |
with: | |
application_id: 264650 | |
application_private_key: ${{ secrets.Automation_App_Key }} | |
organization: actions-marketplace-validations | |
- shell: pwsh | |
name: "Gotta check 'em all: functions" | |
run: | | |
$actions=(Get-Content actions.json | ConvertFrom-Json) | |
Write-Host "Found [$($actions.Length)] actions in the datafile" | |
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 | |
./.github/workflows/functions.ps1 -actions $actions -numberOfReposToDo ${{ env.numberOfReposToDo }} -access_token "${{ secrets.ACCESS_TOKEN }}" -access_token_destination ${{ steps.get_workflow_token2.outputs.token }} | |
# get a new token for the next script, as it might have expired already | |
- 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 check 'em all: repoInfo" | |
run: | | |
$actions=(Get-Content actions.json | ConvertFrom-Json) | |
Write-Host "Found [$($actions.Length)] actions in the datafile" | |
# get repo information | |
${{ github.workspace }}/.github/workflows/repoInfo.ps1 -actions $actions -numberofReposToDo ${{ env.numberOfReposToDoRepoInfo }} -access_token "${{ secrets.ACCESS_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 |