# Weekly freshness check. The dataset is regenerated by hand (`npm run data` # needs the vendored upstreams), so nothing would otherwise tell us that # GTFOBins / LOLBAS / WADComs moved on. This compares each upstream's current # HEAD against the short hash recorded in src/data/facets.json and opens (or # updates) a single tracking issue when any of them drifted. name: Upstream drift on: schedule: - cron: '17 6 * * 1' # Mondays 06:17 UTC workflow_dispatch: permissions: contents: read issues: write jobs: drift: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Compare upstream HEADs with facets.json id: cmp shell: bash run: | set -euo pipefail declare -A REPO=( [gtfobins]=https://github.com/GTFOBins/GTFOBins.github.io [lolbas]=https://github.com/LOLBAS-Project/LOLBAS [wadcoms]=https://github.com/WADComs/WADComs.github.io ) drift=0; body="" for name in gtfobins lolbas wadcoms; do pinned=$(node -p "require('./src/data/facets.json').commits.$name || ''") head=$(git ls-remote "${REPO[$name]}" HEAD | cut -c1-7) if [ -z "$pinned" ]; then body+="- **$name**: no pinned commit recorded (upstream HEAD \`$head\`)"$'\n'; drift=1 elif [ "$pinned" != "$head" ]; then body+="- **$name**: pinned \`$pinned\`, upstream HEAD \`$head\` — ${REPO[$name]}/compare/$pinned...$head"$'\n'; drift=1 else body+="- $name: up to date (\`$pinned\`)"$'\n' fi done echo "drift=$drift" >> "$GITHUB_OUTPUT" { echo 'body<> "$GITHUB_OUTPUT" - name: Open or update the tracking issue if: steps.cmp.outputs.drift == '1' env: GH_TOKEN: ${{ github.token }} BODY: ${{ steps.cmp.outputs.body }} run: | title="Upstream drift: dataset is behind GTFOBins / LOLBAS / WADComs" text="$(printf '%s\n\n%s\n\n%s' "Detected by the weekly drift check on $(date -u +%F)." "$BODY" 'Refresh with `git submodule update --remote vendor/gtfobins vendor/lolbas vendor/wadcoms && npm run data`, then commit `src/data/*.json`.')" existing=$(gh issue list --label upstream-drift --state open --json number --jq '.[0].number // empty') if [ -n "$existing" ]; then gh issue comment "$existing" --body "$text" else gh label create upstream-drift --color c4a7e7 --description "Dataset behind an upstream" 2>/dev/null || true gh issue create --title "$title" --label upstream-drift --body "$text" fi