Skip to content

fix release tag parsing from body#1216

Closed
asraa wants to merge 4 commits intoslsa-framework:mainfrom
asraa:fix-ref-parse
Closed

fix release tag parsing from body#1216
asraa wants to merge 4 commits intoslsa-framework:mainfrom
asraa:fix-ref-parse

Conversation

@asraa
Copy link
Copy Markdown
Contributor

@asraa asraa commented Nov 7, 2022

This is a test!

Signed-off-by: Asra Ali asraa@google.com

Signed-off-by: Asra Ali <asraa@google.com>
@asraa asraa changed the title fix release tag parsing from body dnm: fix release tag parsing from body Nov 7, 2022
asraa added 2 commits November 7, 2022 13:58
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
@asraa asraa changed the title dnm: fix release tag parsing from body fix release tag parsing from body Nov 7, 2022
@asraa
Copy link
Copy Markdown
Contributor Author

asraa commented Nov 7, 2022

Just used a grep match for a version string: https://github.com/slsa-framework/slsa-github-generator/actions/runs/3413607704/jobs/5680520567

Worked here @laurentsimon

Signed-off-by: Asra Ali <asraa@google.com>
if: ${{ contains(github.event.pull_request.body, '#label:release') }}
run: |
echo ${{ github.event.pull_request.body }} | awk '{print $2}'
RELEASE_TAG=$(echo "${{ github.event.pull_request.body }}" | grep -o -e 'v[0-9].[0-9].[0-9]')
Copy link
Copy Markdown
Member

@ianlewis ianlewis Nov 7, 2022

Choose a reason for hiding this comment

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

'.' will get interpreted as regex so it probably should be escaped. otherwise it matches strings like 'v1a2b3'. Also we'll want to match multiple digits.

Suggested change
RELEASE_TAG=$(echo "${{ github.event.pull_request.body }}" | grep -o -e 'v[0-9].[0-9].[0-9]')
RELEASE_TAG=$(echo "${{ github.event.pull_request.body }}" | grep -o -e 'v[0-9]\+\.[0-9]\+\.[0-9]\+')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Noted, I think it got copied into https://github.com/slsa-framework/slsa-github-generator/pull/1210/files, let's merge yours which does a code freeze, but I'll fix that next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants