Skip to content

Commit 0f878ff

Browse files
authored
Added testing against discourse versions: latest and ESR
2 parents 56b827a + df6d815 commit 0f878ff

File tree

5 files changed

+109
-14
lines changed

5 files changed

+109
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: Discourse Plugin
1+
name: Discourse ESR
22

33
on:
44
push:
55
branches:
66
- main
77
pull_request:
8+
workflow_dispatch:
89

910
jobs:
1011
ci:
1112
uses: discourse/.github/.github/workflows/discourse-plugin.yml@v1
13+
with:
14+
core_ref: esr

.github/workflows/latest.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Discourse latest
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
ci:
12+
uses: discourse/.github/.github/workflows/discourse-plugin.yml@v1
13+
with:
14+
core_ref: latest
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Discourse Branch Update Check
2+
3+
on:
4+
schedule:
5+
# Runs once a week
6+
- cron: '34 5 * * 5'
7+
workflow_dispatch:
8+
9+
jobs:
10+
check-updates:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
include:
15+
- branch: latest
16+
workflow: latest.yml
17+
- branch: esr
18+
workflow: esr.yml
19+
steps:
20+
- id: retrieve-lastrev
21+
env:
22+
branch: ${{ matrix.branch }}
23+
run: |
24+
git clone --bare --filter=blob:none --depth=1 --single-branch --branch=${branch} https://github.com/discourse/discourse disc
25+
git -C disc rev-parse @ > last-revision
26+
cp last-revision current-revision
27+
- id: cache
28+
uses: actions/cache@v4
29+
with:
30+
path: last-revision
31+
key: uscheck-${{ matrix.branch }}-${{ hashFiles('last-revision') }}
32+
restore-keys: |
33+
uscheck-${{ matrix.branch }}-
34+
- id: trigger-wf
35+
env:
36+
branch: ${{ matrix.branch }}
37+
workflow: ${{ matrix.workflow }}
38+
cache_hit: ${{ steps.cache.outputs.cache-hit }}
39+
GH_TOKEN: ${{ github.token }}
40+
run: |
41+
NEW_REV=$(cat current-revision)
42+
# cache_hit is empty on initial; false when an older cache was restored
43+
[ -n "${cache_hit}" ] && OLD_REV=$(cat last-revision || true)
44+
ls -l current-revision last-revision
45+
echo "NEW_REV=$NEW_REV"
46+
echo "OLD_REV=$OLD_REV"
47+
echo "cache_hit=$cache_hit"
48+
if [ "$NEW_REV" != "$OLD_REV" ]; then
49+
echo "Changes detected"
50+
echo "🆕 Discourse branch ${branch} revision changed" >> $GITHUB_STEP_SUMMARY
51+
echo >> $GITHUB_STEP_SUMMARY
52+
echo "Latest commit: https://github.com/discourse/discourse/commit/${NEW_REV}" >> $GITHUB_STEP_SUMMARY
53+
echo >> $GITHUB_STEP_SUMMARY
54+
if [ -n "${cache_hit}" ]; then
55+
echo "Changes: https://github.com/discourse/discourse/compare/${OLD_REV}...${NEW_REV}" >> $GITHUB_STEP_SUMMARY
56+
echo >> $GITHUB_STEP_SUMMARY
57+
fi
58+
echo "Triggering workflow: ${workflow}" >> $GITHUB_STEP_SUMMARY
59+
60+
echo "$NEW_REV" > last-revision
61+
gh api \
62+
--method POST \
63+
-H "Accept: application/vnd.github+json" \
64+
-H "X-GitHub-Api-Version: 2022-11-28" \
65+
/repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow}/dispatches \
66+
-f "ref=${GITHUB_REF_NAME}"
67+
else
68+
echo "🆗 No changes in Discourse branch: ${branch}" >> $GITHUB_STEP_SUMMARY
69+
fi

Gemfile.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (8.0.3)
4+
activesupport (8.0.2.1)
55
base64
66
benchmark (>= 0.3)
77
bigdecimal
@@ -17,13 +17,13 @@ GEM
1717
ast (2.4.3)
1818
base64 (0.3.0)
1919
benchmark (0.4.1)
20-
bigdecimal (3.2.3)
20+
bigdecimal (3.2.2)
2121
concurrent-ruby (1.3.5)
22-
connection_pool (2.5.4)
22+
connection_pool (2.5.3)
2323
drb (2.2.3)
2424
i18n (1.14.7)
2525
concurrent-ruby (~> 1.0)
26-
json (2.15.0)
26+
json (2.13.2)
2727
language_server-protocol (3.17.0.5)
2828
lint_roller (1.1.0)
2929
logger (1.7.0)
@@ -33,12 +33,12 @@ GEM
3333
ast (~> 2.4.1)
3434
racc
3535
prettier_print (1.2.1)
36-
prism (1.5.1)
36+
prism (1.4.0)
3737
racc (1.8.1)
3838
rack (3.2.3)
3939
rainbow (3.1.1)
40-
regexp_parser (2.11.3)
41-
rubocop (1.80.2)
40+
regexp_parser (2.11.2)
41+
rubocop (1.79.2)
4242
json (~> 2.3)
4343
language_server-protocol (~> 3.17.0.2)
4444
lint_roller (~> 1.1.0)
@@ -49,7 +49,7 @@ GEM
4949
rubocop-ast (>= 1.46.0, < 2.0)
5050
ruby-progressbar (~> 1.7)
5151
unicode-display_width (>= 2.4.0, < 4.0)
52-
rubocop-ast (1.47.1)
52+
rubocop-ast (1.46.0)
5353
parser (>= 3.3.7.2)
5454
prism (~> 1.4)
5555
rubocop-capybara (2.22.1)
@@ -73,7 +73,7 @@ GEM
7373
rack (>= 1.1)
7474
rubocop (>= 1.75.0, < 2.0)
7575
rubocop-ast (>= 1.44.0, < 2.0)
76-
rubocop-rspec (3.7.0)
76+
rubocop-rspec (3.6.0)
7777
lint_roller (~> 1.1)
7878
rubocop (~> 1.72, >= 1.72.1)
7979
rubocop-rspec_rails (2.31.0)
@@ -86,9 +86,9 @@ GEM
8686
prettier_print (>= 1.2.0)
8787
tzinfo (2.0.6)
8888
concurrent-ruby (~> 1.0)
89-
unicode-display_width (3.2.0)
90-
unicode-emoji (~> 4.1)
91-
unicode-emoji (4.1.0)
89+
unicode-display_width (3.1.5)
90+
unicode-emoji (~> 4.0, >= 4.0.4)
91+
unicode-emoji (4.0.4)
9292
uri (1.0.3)
9393
yaml-lint (0.1.2)
9494

@@ -102,4 +102,4 @@ DEPENDENCIES
102102
yaml-lint
103103

104104
BUNDLED WITH
105-
2.7.1
105+
2.7.2

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ In order to use this plugin you need to sign up with [Dark Visitors](https://dar
1313

1414
For more information and discussion see [this thread](https://meta.discourse.org/t/dark-visitors/365158) on the Discourse Meta forum.
1515

16+
## Plugin Compatibility Status
17+
18+
[![Discourse latest](https://github.com/magicball-network/discourse-darkvisitors/actions/workflows/latest.yml/badge.svg)](https://github.com/magicball-network/discourse-darkvisitors/actions/workflows/latest.yml)
19+
20+
[![Discourse ESR](https://github.com/magicball-network/discourse-darkvisitors/actions/workflows/esr.yml/badge.svg)](https://github.com/magicball-network/discourse-darkvisitors/actions/workflows/esr.yml)
21+
22+
The above status is based on the plugin's executed tests against the specified Discourse branch.
23+
It is no definite guarantee that there no issues.
24+
1625
## Augmenting robots.txt
1726

1827
With this enabled the robots.txt file created by Discourse will be augmented with [agents](https://darkvisitors.com/agents) from the configured categories.

0 commit comments

Comments
 (0)