Repository navigation
68 lines (61 loc) · 2.5 KB
/
Copy pathupstream-watch.yml
File metadata and controls
68 lines (61 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# The versions this package builds are shell variables in build.sh, not a manifest, so no
# dependency bot sees them. This is the thing that watches them.
#
# It keeps exactly one issue: opened when a pin falls behind, rewritten while it stays behind,
# and closed by the run that finds everything current again. Nothing is posted when there is
# nothing to do, which is what keeps it worth reading.
name: Upstream watch
on:
schedule:
- cron: "0 6 * * 1" # Mondays, 06:00 UTC
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# dolby_vision is pinned in the sibling repository. Checking it here keeps one place to
# look rather than a second watcher raising a second issue somewhere else.
- uses: actions/checkout@v7
with:
repository: superuser404notfound/LibDovi
path: .libdovi
- name: Compare pins against upstream
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
set +e
python3 Scripts/check-upstream.py --libdovi .libdovi/build.sh > report.md
echo "behind=$?" >> "$GITHUB_OUTPUT"
set -e
cat report.md
- name: Raise, update or close the issue
env:
GH_TOKEN: ${{ github.token }}
BEHIND: ${{ steps.check.outputs.behind }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
TITLE="Upstream dependencies have newer releases"
EXISTING=$(gh issue list --state open --limit 100 --json number,title \
--jq "[.[] | select(.title == \"$TITLE\")] | .[0].number // empty")
if [ "$BEHIND" = "1" ]; then
{ cat report.md
printf '\n---\n\nChecked by [Upstream watch](%s). This issue is rewritten on every run and closes itself once every pin is current.\n' "$RUN_URL"
} > body.md
if [ -n "$EXISTING" ]; then
gh issue edit "$EXISTING" --body-file body.md
echo "updated #$EXISTING"
else
gh issue create --title "$TITLE" --body-file body.md
fi
elif [ -n "$EXISTING" ]; then
gh issue close "$EXISTING" --comment "Every pinned source is current again. Closed by [Upstream watch]($RUN_URL)."
echo "closed #$EXISTING"
else
echo "every pin is current, nothing to report"
fi