-
Notifications
You must be signed in to change notification settings - Fork 473
131 lines (130 loc) · 6.5 KB
/
automerge.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: AutoMerge
on:
pull_request:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
types: [opened, reopened, labeled, synchronize]
schedule:
# The cron job is just a fallback.
# The "stopwatch" functionality that we have implemented should
# ensure that an AutoMerge merge job is run at least every 8 minutes.
# Therefore, it's sufficient for us to run the fallback job infrequently.
# We will choose to run the fallback job every 4 hours.
- cron: '0 */4 * * *'
workflow_dispatch:
env:
JULIA_PKG_USE_CLI_GIT: true
# We only need the merging token
# if we are on the master branch and running either a workflow dispatch
# (possibly from the stopwatch mechanism) or a scheduled job.
# See also the same logic inside RegistryCI:
# https://github.com/JuliaRegistries/RegistryCI.jl/blob/ee1d7cdb165202f4f3929a122c3188fbdd7afc16/src/AutoMerge/ciservice.jl#L53-L67
NEED_MERGE_TOKEN: ${{ github.ref == 'refs/heads/master' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
jobs:
AutoMerge:
# Run if:
# - not from a PR event
# - or it is from a PR event AND it is not from a fork, AND either:
# - we are not triggered by a label OR
# - we are triggered by a label, and that label is one that affects the execution of the workflow
# Note: since the label contains a colon, we need to use a workaround like https://github.com/actions/runner/issues/1019#issuecomment-810482716
# for the syntax to parse correctly.
if: "${{ github.event_name != 'pull_request' || (github.repository == github.event.pull_request.head.repo.full_name && (github.event.action != 'labeled' || (github.event.action == 'labeled' && (github.event.label.name == 'Override AutoMerge: name similarity is okay' || github.event.label.name == 'Override AutoMerge: package author approved')))) }}"
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- '1.11'
os:
- ubuntu-latest
arch:
- x64
steps:
# For debugging purposes, we print this value first
- name: Print env variable NEED_MERGE_TOKEN
run: echo "NEED_MERGE_TOKEN=$NEED_MERGE_TOKEN"
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: julia-actions/setup-julia@5c9647d97b78a5debe5164e9eec09d653d29bd71 # v2.6.1
with:
version: ${{ matrix.version }}
- name: Cache artifacts
uses: julia-actions/cache@824243901fb567ccb490b0d0e2483ccecde46834 # v2.0.5
- run: write(ENV["GITHUB_OUTPUT"], "manifest_version=$(VERSION.major).$(VERSION.minor)")
shell: julia --color=yes --project=.ci/ {0}
id: manifest_version
- run: echo "The manifest is .ci/Manifest-v${{ steps.manifest_version.outputs.manifest_version }}.toml"
- run: rm -rf .ci/Manifest.toml
- run: mv .ci/Manifest-v${{ steps.manifest_version.outputs.manifest_version }}.toml .ci/Manifest.toml
- run: rm -rf .ci/Manifest-*.toml
- run: chmod 400 .ci/Project.toml
- run: chmod 400 .ci/Manifest.toml
- run: julia --color=yes -e 'import Pkg; Pkg.Registry.add("General")'
env:
JULIA_PKG_SERVER: ""
- run: julia --color=yes -e 'import Pkg; Pkg.Registry.update()'
- run: .ci/instantiate.sh
- run: julia --color=yes --project=.ci/ -e 'import Pkg; Pkg.precompile()'
- name: AutoMerge.run
env:
MERGE_NEW_PACKAGES: true
MERGE_NEW_VERSIONS: true
AUTOMERGE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# populate the actual token below only if `NEED_MERGE_TOKEN` is true, otherwise pass the empty string
# this uses the ternary syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#example
AUTOMERGE_TAGBOT_TOKEN: ${{ env.NEED_MERGE_TOKEN == 'true' && secrets.TAGBOT_TOKEN || '' }}
JULIA_DEBUG: RegistryCI,AutoMerge
run: |
using RegistryCI
using Dates
RegistryCI.AutoMerge.run(
merge_new_packages = ENV["MERGE_NEW_PACKAGES"] == "true",
merge_new_versions = ENV["MERGE_NEW_VERSIONS"] == "true",
new_package_waiting_period = Day(3),
new_jll_package_waiting_period = Minute(20),
new_version_waiting_period = Minute(10),
new_jll_version_waiting_period = Minute(10),
registry = "JuliaRegistries/General",
tagbot_enabled = true,
authorized_authors = String["JuliaRegistrator"],
authorized_authors_special_jll_exceptions = String["jlbuild"],
suggest_onepointzero = false,
additional_statuses = String[],
additional_check_runs = String[],
check_license = true,
public_registries = String[
"https://github.com/HolyLab/HolyLabRegistry",
"https://github.com/cossio/CossioJuliaRegistry"
],
point_to_slack = true,
)
shell: julia --color=yes --project=.ci/ {0}
AutoMerge-stopwatch:
timeout-minutes: 20
if: github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name
environment: stopwatch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: julia-actions/setup-julia@5c9647d97b78a5debe5164e9eec09d653d29bd71 # v2.6.1
with:
version: '1.11'
- name: Cache artifacts
uses: julia-actions/cache@824243901fb567ccb490b0d0e2483ccecde46834 # v2.0.5
- run: write(ENV["GITHUB_OUTPUT"], "manifest_version=$(VERSION.major).$(VERSION.minor)")
shell: julia --color=yes --project=.ci/ {0}
id: manifest_version
- run: rm -rf .ci/Manifest.toml
- run: mv .ci/Manifest-v${{ steps.manifest_version.outputs.manifest_version }}.toml .ci/Manifest.toml
- run: rm -rf .ci/Manifest-*.toml
- run: chmod 400 .ci/Project.toml
- run: chmod 400 .ci/Manifest.toml
- run: julia --color=yes -e 'import Pkg; Pkg.Registry.add("General")'
env:
JULIA_PKG_SERVER: ""
- run: julia --color=yes -e 'import Pkg; Pkg.Registry.update()'
- run: .ci/instantiate.sh
- run: julia --color=yes --project=.ci/ -e 'import Pkg; Pkg.precompile()'
- run: julia --project=.ci/ .ci/stopwatch.jl
env:
AUTOMERGE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUTOMERGE_TAGBOT_TOKEN: ${{ secrets.TAGBOT_TOKEN }}