Skip to content

Commit

Permalink
chore: fetch enough commits for git describe to discover tags
Browse files Browse the repository at this point in the history
  • Loading branch information
theseion committed Aug 7, 2024
1 parent d66b1bf commit f079578
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
# we want to use `git describe` to find the latest tag
fetch-depth: 50

- name: Lint Yaml
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1
Expand All @@ -36,15 +39,6 @@ jobs:
pip install secrules-parsing==${{ env.SECRULES_PARSING_VERSION }}
secrules-parser -c --output-type github -f rules/*.conf
- name: "Fetch git tags"
run: |
git tag -l
git fetch --tags
- name: "Show current tag"
run: |
git describe --tags
- name: "Check CRS formatting"
run: |
pip install --upgrade setuptools
Expand Down
9 changes: 5 additions & 4 deletions util/crs-rules-check/rules-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def check_tags(self, fname, tagslist):
aidx += 1

def check_lowercase_ignorecase(self):
ruleid = 0
ruleid = 0
for d in self.data:
if d['type'].lower() == "secrule":
if d['operator'] == "@rx":
Expand All @@ -614,7 +614,7 @@ def check_lowercase_ignorecase(self):
aidx = 0 # stores the index of current action
while aidx < len(d['actions']):
# read the action into 'a'
a = d['actions'][aidx]
a = d['actions'][aidx]
if a['act_name'] == "id":
ruleid = int(a['act_arg'])
if a['act_name'] == 't':
Expand Down Expand Up @@ -817,7 +817,9 @@ def generate_version_string():
v4.5.0-0-abcd01234 -> "4.5.0"
"""
result = subprocess.run(["git", "describe", "--tags"], capture_output=True, text=True)
print(result)
version = re.sub("^v", "", result.stdout.strip())
print(version)
ver, commits = version.split("-")[0:2]
if int(commits) > 0:
version = ver.split(".")
Expand Down Expand Up @@ -1074,7 +1076,7 @@ def generate_version_string():
a['title'] = "new unlisted tag"
errmsgf(a)
retval = 1
### check for t:lowercase in combination with (?i) in regex
### check for t:lowercase in combination with (?i) in regex
c.check_lowercase_ignorecase()
if len(c.ignorecase) == 0:
msg(" No t:lowercase and (?i) flag used.")
Expand Down Expand Up @@ -1130,4 +1132,3 @@ def generate_version_string():
msg(" No unused TX variable")

sys.exit(retval)

0 comments on commit f079578

Please sign in to comment.