Skip to content
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

[25.0 backport] ci/validate-pr: Use ::error:: command to print errors #47703

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Missing `area/` label
if: contains(join(github.event.pull_request.labels.*.name, ','), 'impact/') && !contains(join(github.event.pull_request.labels.*.name, ','), 'area/')
run: |
echo "Every PR with an \`impact/*\` label should also have an \`area/*\` label"
echo "::error::Every PR with an 'impact/*' label should also have an 'area/*' label"
exit 1
Comment on lines 13 to 15
Copy link
Member

Choose a reason for hiding this comment

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

As follow-up we could look at using https://github.com/actions/github-script:

uses: actions/github-script@v7
with:
  script: |
    core.setFailed(`Every PR with an 'impact/*' label should also have an 'area/*' label`);

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any visual difference between these though?

- name: OK
run: exit 0
Expand All @@ -32,13 +32,13 @@ jobs:
desc=$(echo "$block" | awk NF)

if [ -z "$desc" ]; then
echo "Changelog section is empty. Please provide a description for the changelog."
echo "::error::Changelog section is empty. Please provide a description for the changelog."
exit 1
fi

len=$(echo -n "$desc" | wc -c)
if [[ $len -le 6 ]]; then
echo "Description looks too short: $desc"
echo "::error::Description looks too short: $desc"
exit 1
fi

Expand Down