forked from theupdateframework/python-tuf
-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (62 loc) · 2.47 KB
/
specification-version.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
name: Specification version check
on:
schedule:
- cron: '0 13 * * *'
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
check-spec-version:
name: Open an issue when spec version bumps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6
- name: Get supported version
id: get-version
run: |
python3 -m pip install -e .
script="from tuf.api.metadata import SPECIFICATION_VERSION; \
print(f\"v{'.'.join(SPECIFICATION_VERSION)}\")"
ver=$(python3 -c "$script")
echo "::set-output name=version::$ver"
- name: Open issue (if needed)
uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e
with:
script: |
const release = await github.rest.repos.getLatestRelease({
owner: "theupdateframework",
repo: "specification"
});
const spec_version = release.data.tag_name
const supported_version = "${{ steps.get-version.outputs.version }}"
if (spec_version != supported_version) {
console.log(
"Specification (" + spec_version + ") version does not matches with python-tuf supported (" +
supported_version + ") version."
)
const repo = context.repo.owner + "/" + context.repo.repo
const issues = await github.rest.search.issuesAndPullRequests({
q: "specification+has+new+version+in:title+state:open+type:issue+repo:" + repo,
})
if (issues.data.total_count > 0) {
console.log("Issue is already open, not creating.")
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "specification has new version",
body: "It seems specification " +
"(https://github.com/theupdateframework/specification/blob/master/tuf-spec.md) " +
"has new version. \n" +
"Please review the version."
})
console.log("New issue created.")
}
} else {
console.log(
"Specification (" + spec_version + ") version matches with python-tuf supported (" +
supported_version + ") version."
)
}