Skip to content
18 changes: 10 additions & 8 deletions .github/workflows/scb-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ jobs:
fi
fi

echo $upgrade
echo releaseGithub=$release >> $GITHUB_ENV #
echo release=$upgrade >> $GITHUB_ENV
# ^ The first echo sets how the release version looks in github releases and the second sets how the release version looks in docker images

- name: Check if scanner is outdated and if PR already exists
if: ${{ env.release != env.local && env.release != null }}
Expand All @@ -78,10 +79,14 @@ jobs:

- name: Fetch new release changelog
if: ${{ env.release != env.local && env.release != null }}
# Fetches changelog and filters out any issue references
# Reformats the versionApi to have an HTML view of the release changelog
# sed command is divided into three parts s/api.//g; , s/\/repos//g; and s/latest//g
# "api." and "/repos" and "latest" are replaced with nothing (a.k.a removed)
# example: https://api.github.com/repos/OWASP/Amass/releases/latest --> https://github.com/OWASP/Amass/releases/
# the next command then appends the link with the new release version as it is in Github.
run: |
changelog=$(curl -sL ${{env.versionApi}} | jq -r ".body")
echo 'releaseChangelog=$changelog' >> $GITHUB_ENV
changelog=$(echo ${{env.versionApi}} | sed -e 's/api.//g;s/\/repos//g;s/latest//g')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment (maybe with an example) on what this replace looks like?
Had some problems properly understanding what this is doing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

echo releaseChangelog=${changelog}${{env.releaseGithub}} >> $GITHUB_ENV

- name: Upgrade Scanner Helm Chart
if: ${{ env.release != env.local && env.prExists == 0 && env.release != null}}
Expand Down Expand Up @@ -139,10 +144,7 @@ jobs:
title: ${{ env.pullRequest }}
body: |
This is an automated Pull Request by the SCB-Bot. It upgrades ${{ matrix.scanner }} from ${{env.local}} to ${{env.release}}
## Release changes :
```
${{env.releaseChangelog}}
```
### Release changes : [here](${{env.releaseChangelog}})
branch: "dependencies/upgrading-${{ matrix.scanner }}-to-${{env.release}}"
labels: dependencies,scanner
commit-message: "Upgrading ${{ matrix.scanner }} from ${{env.local}} to ${{env.release}}"
Expand Down