-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update snyk branch monitoring in bump-version workflow #2998
base: main
Are you sure you want to change the base?
Conversation
This pull request does not have a backport label. Could you fix it @orouz? 🙏
|
@@ -33,6 +32,7 @@ jobs: | |||
with: | |||
ref: ${{ github.ref_name }} | |||
token: ${{ secrets.CLOUDSEC_MACHINE_TOKEN }} | |||
fetch-depth: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed to get all branches as we'll be extracting the latest_major_latest_minor
and previous_major_latest_minor
branches=$(git branch -r | grep -Eo '[0-9]+\.[0-9]+' | sort -V | uniq) | ||
# shellcheck disable=SC2128 | ||
latest_major=$(echo "$branches" | cut -d. -f1 | uniq | tail -1) | ||
# shellcheck disable=SC2128 | ||
previous_major=$(echo "$branches" | cut -d. -f1 | uniq | tail -2 | head -1) | ||
# shellcheck disable=SC2128 | ||
latest_major_latest_minor=$(echo "$branches" | grep -E "^$latest_major\." | tail -1) | ||
# shellcheck disable=SC2128 | ||
previous_major_latest_minor=$(echo "$branches" | grep -E "^$previous_major\." | tail -1) | ||
echo "latest_major_latest_minor: $latest_major_latest_minor" | ||
echo "previous_major_latest_minor: $previous_major_latest_minor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this assumes the workflow is ran after the release branch were created (will fail before this runs if they aren't)
- copy-paste the lines to test on remote and remove
-r
to test locally
Summary of your changes
the bump-version workflow includes a part where we import the required branches to be scanned by snyk. this PR includes a fix to make it work regardless of the base branch the workflow is executed from.
(the issue is that snyk import api is limited and we're deleting the previous import and adding it again, not updating, so currently we're overriding. this is what is being fixed here)
example run
Related Issues