Nightly Audit #1725
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: Nightly Audit | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SPI_API_TOKEN: ${{ secrets.SPI_API_TOKEN }} | |
jobs: | |
build_validator: | |
runs-on: ubuntu-latest | |
container: | |
image: swift:6.0.1-jammy | |
steps: | |
- name: Build validator | |
run: | | |
git clone https://github.com/SwiftPackageIndex/PackageList-Validator.git --depth 1 | |
cd PackageList-Validator | |
swift build | |
cp $(swift build --show-bin-path)/validator $GITHUB_WORKSPACE/ | |
- name: Upload validator | |
uses: actions/upload-artifact@v4 | |
with: | |
name: validator | |
path: validator | |
check_redirects: | |
needs: build_validator | |
env: | |
CONCURRENCY: "10" | |
runs-on: ubuntu-latest | |
container: | |
image: swift:6.0.1-jammy | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download validator | |
uses: actions/download-artifact@v4 | |
with: | |
name: validator | |
- name: Check redirect | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 60 | |
max_attempts: 1 | |
retry_on: error | |
command: | | |
chmod +x ./validator | |
./validator check-redirects -i packages.json -o redirect-checked.json --concurrency $CONCURRENCY | |
echo "diff packages.json redirect-checked.json" | |
diff packages.json redirect-checked.json || true | |
- name: Upload redirect-checked.json | |
uses: actions/upload-artifact@v4 | |
with: | |
name: redirect-checked.json | |
path: redirect-checked.json | |
check_dependencies: | |
needs: check_redirects | |
runs-on: ubuntu-latest | |
container: | |
image: swift:6.0.1-jammy | |
steps: | |
# we need to check out the repo in the last step in order to create a PR | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download validator | |
uses: actions/download-artifact@v4 | |
with: | |
name: validator | |
- name: Download redirect-checked.json | |
uses: actions/download-artifact@v4 | |
with: | |
name: redirect-checked.json | |
- name: Check dependencies | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 60 | |
max_attempts: 1 | |
retry_on: error | |
command: | | |
chmod +x ./validator | |
./validator check-dependencies \ | |
--spi-api-token $SPI_API_TOKEN \ | |
--input redirect-checked.json --output packages.json \ | |
--limit 20 | |
./validator apply-deny-list -p packages.json -d denylist.json | |
# Stop artifacts from appearing in the PR | |
rm -f redirect-checked.json validator | |
- name: Create pull request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: Updated Packages | |
title: '[Nightly] Updated Packages' | |
body: | | |
:robot: This is an automated change | |
- Removed any redirects | |
- Removed any duplicates | |
- Removed any deleted repositories | |
- Added any unknown dependencies | |
- name: Check outputs | |
run: echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |