-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh action to find chain and scope on release branch pushed (#2304)
- Loading branch information
1 parent
1d98cdb
commit 63efabc
Showing
2 changed files
with
69 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import re | ||
|
||
regex = r"release-(karura|acala)-(\d+\.\d+\.\d+)" | ||
|
||
# find chain and version from current branch | ||
x = re.search(regex, os.getenv("GITHUB_REF")) | ||
chain = x.group(1) | ||
version = x.group(2) | ||
|
||
branches = os.popen("git branch -a | grep remotes/origin/release-{}-".format(chain)).read().split("\n") | ||
branches = map(lambda x: x.strip(), branches) | ||
branches = list(filter(None, branches)) | ||
# select previous branch | ||
previous_branches = branches[-2] | ||
|
||
# find previous version | ||
x = re.search(regex, previous_branches) | ||
previous_version = x.group(2) | ||
|
||
is_patch = previous_version.split(".")[1] == version.split(".")[1] | ||
scope = "runtime" if is_patch else "full" | ||
|
||
with open(os.getenv("GITHUB_ENV"), "a") as env: | ||
env.write("CHAIN={}\n".format(chain)) | ||
env.write("SCOPE={}\n".format(scope)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters