Skip to content

Nightly Audit

Nightly Audit #1697

Workflow file for this run

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 artifacts
uses: actions/upload-artifact@v3
with:
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 artifacts
uses: actions/download-artifact@v3
with:
name: artifact
- 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 artifacts
uses: actions/upload-artifact@v3
with:
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 artifacts
uses: actions/download-artifact@v3
with:
name: artifact
- 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 }}"