The scan job ran the full repository scan, about a minute, on every pull request, although a change to .github, scripts, .agents or a top-level Markdown file cannot change what pkgcheck reports. scan is a required check, so the job still runs and only skips the pkgcheck step when every file the pull request changes is one of those. Pushes to master always scan. Signed-off-by: Zakk <zakk@gentoozh.org>
84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
name: pkgcheck
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
scan:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v7
|
|
|
|
# scan is a required check, so the job always runs and only the scan is skipped
|
|
- name: check for files pkgcheck reads
|
|
id: files
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR: ${{ github.event.pull_request.number }}
|
|
run: |
|
|
files=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/files" --paginate --jq '.[].filename')
|
|
if grep -qvE '^(\.github/|scripts/|\.agents/|[^/]+\.md$)' <<< "$files"; then
|
|
echo "scan=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "scan=false" >> "$GITHUB_OUTPUT"
|
|
echo "This pull request changes only CI, scripts and documentation, so the repository scan is skipped."
|
|
fi
|
|
|
|
- name: run pkgcheck
|
|
if: steps.files.outputs.scan != 'false'
|
|
uses: pkgcore/pkgcheck-action@v1
|
|
with:
|
|
args: --checks=-RedundantVersionCheck --keywords=-NonsolvableDepsInDev --exit=NonexistentDeps
|
|
|
|
# Ebuilds execute PR code; the write token belongs to pkgcheck-comment.
|
|
report:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/pkgcore/pkgcheck:latest
|
|
defaults:
|
|
run:
|
|
# The image has no /bin/bash symlink.
|
|
shell: bash
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: collect the packages this PR touches
|
|
id: pkgs
|
|
run: scripts/pkgcheck-report.sh packages
|
|
|
|
- name: scan
|
|
if: steps.pkgs.outputs.count != '0'
|
|
run: scripts/pkgcheck-report.sh scan
|
|
|
|
- name: stage the report
|
|
if: ${{ !cancelled() }}
|
|
run: scripts/pkgcheck-report.sh stage
|
|
|
|
- name: upload the report
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: pkgcheck-report
|
|
path: pkgcheck-report/
|