# 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 drifton:
schedule:
- cron: '176**1'# Mondays 06:17 UTCworkflow_dispatch:
permissions:
contents: readissues: writejobs:
drift:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v4 - name: Compare upstream HEADs with facets.jsonid: cmpshell: bashrun: |
set -euo pipefaildeclare -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; dopinned=$(node -p "require('./src/data/facets.json').commits.$name || ''")head=$(git ls-remote "${REPO[$name]}" HEAD | cut -c1-7)if [ -z "$pinned" ]; thenbody+="- **$name**: no pinned commit recorded (upstream HEAD \`$head\`)"$'\n'; drift=1elif [ "$pinned" != "$head" ]; thenbody+="- **$name**: pinned \`$pinned\`, upstream HEAD \`$head\` — ${REPO[$name]}/compare/$pinned...$head"$'\n'; drift=1elsebody+="- $name: up to date (\`$pinned\`)"$'\n'fidoneecho "drift=$drift" >> "$GITHUB_OUTPUT"{ echo 'body<<EOF'; echo "$body"; echo 'EOF'; } >> "$GITHUB_OUTPUT" - name: Open or update the tracking issueif: 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" ]; thengh issue comment "$existing" --body "$text"elsegh label create upstream-drift --color c4a7e7 --description "Dataset behind an upstream" 2>/dev/null || truegh issue create --title "$title" --label upstream-drift --body "$text"fi