-
Notifications
You must be signed in to change notification settings - Fork 3.4k
78 lines (65 loc) · 2.82 KB
/
Copy pathversion-check.yml
File metadata and controls
78 lines (65 loc) · 2.82 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
69
70
71
72
73
74
75
76
77
78
name: Check work package version
on:
pull_request:
types:
- opened
- labeled
- synchronize
- ready_for_review
permissions:
contents: read # to fetch code (actions/checkout)
pull-requests: write # to comment on the PR
jobs:
version-check:
# Skip automation PRs (dependabot, copilot, the release merge PRs opened by
# openprojectci) as they never link a work package.
if: >-
github.event.pull_request.draft == false
&& github.event.pull_request.user.type != 'Bot'
&& github.event.pull_request.user.login != 'openprojectci'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1
- name: Verify linked version matches core version
id: version-check
env:
PR_BODY: ${{ github.event.pull_request.body }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: ./script/ci/version_check.sh
- name: Add comment if no work package is linked
if: steps.version-check.outputs.no_ticket == 'true'
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3
with:
header: version-mismatch-comment
message: |
> [!WARNING]
> This pull request does not link an OpenProject work package.
Please add a link to the work package in the description, or reference it in the
title in square brackets, e.g. `[SLUG-123] My title here`.
- name: Add comment if versions differ
if: steps.version-check.outputs.version_mismatch == 'true'
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3
with:
header: version-mismatch-comment
message: |
> [!CAUTION]
> The provided work package version does not match the core version
Details:
- Work package URL: ${{ steps.version-check.outputs.wp_url }}
- Work package version: ${{steps.version-check.outputs.wp_version}}
- Core version: ${{steps.version-check.outputs.core_version}}
Please make sure that:
- The work package version OR your pull request target branch is correct
- name: Version check passed
if: |
steps.version-check.outputs.behind_feature_flag == 'true' ||
(steps.version-check.outputs.version_mismatch != 'true' && steps.version-check.outputs.no_ticket != 'true')
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3
with:
header: version-mismatch-comment
delete: true