Upstream Monitor #3
This file contains hidden or 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: Upstream Monitor | |
| on: | |
| schedule: | |
| - cron: '17 5 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| monitor: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Check upstream package and base image | |
| id: check | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .tmp | |
| current_base=$(grep -m1 '^FROM ghcr.io/linuxserver/baseimage-alpine:' Dockerfile | cut -d: -f2) | |
| package_version=$(docker run --rm alpine:3.24 sh -c 'apk update >/dev/null && apk search -x postgresql16 2>/dev/null | head -1 || true') | |
| { | |
| echo "# Upstream monitor" | |
| echo | |
| printf '%s\n' '- Image: `postgresql-lsio`' | |
| printf '%s\n' "- Current LSIO base tag: \`${current_base:-unknown}\`" | |
| printf '%s\n' "- Alpine package signal: \`${package_version:-not found}\`" | |
| echo "- Upstream: https://www.postgresql.org/" | |
| } | tee .tmp/upstream-summary.md | |
| cat .tmp/upstream-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Create or update upstream tracking issue | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const title = 'Upstream monitor: postgresql-lsio'; | |
| const marker = '<!-- upstream-monitor:postgresql-lsio -->'; | |
| const body = `${marker}\n${fs.readFileSync('.tmp/upstream-summary.md', 'utf8')}\n\nThis issue is managed by the upstream monitor workflow.`; | |
| const {owner, repo} = context.repo; | |
| const existing = await github.rest.issues.listForRepo({owner, repo, state: 'open', labels: 'upstream-monitor'}); | |
| const issue = existing.data.find(i => i.title === title); | |
| if (issue) { | |
| await github.rest.issues.update({owner, repo, issue_number: issue.number, body}); | |
| } else { | |
| await github.rest.issues.create({owner, repo, title, body, labels: ['upstream-monitor']}); | |
| } |