Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
a2f1f3b0
Unverified
Commit
a2f1f3b0
authored
Nov 07, 2024
by
Russell Bryant
Committed by
GitHub
Nov 07, 2024
Browse files
[CI/Build] Automate PR body text cleanup (#10082)
Signed-off-by:
Russell Bryant
<
rbryant@redhat.com
>
parent
3be5b26a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
.github/scripts/cleanup_pr_body.sh
.github/scripts/cleanup_pr_body.sh
+33
-0
.github/workflows/cleanup_pr_body.yml
.github/workflows/cleanup_pr_body.yml
+23
-0
No files found.
.github/scripts/cleanup_pr_body.sh
0 → 100755
View file @
a2f1f3b0
#!/bin/bash
set
-eu
# ensure 1 argument is passed
if
[
"$#"
-ne
1
]
;
then
echo
"Usage:
$0
<pr_number>"
exit
1
fi
PR_NUMBER
=
$1
OLD
=
/tmp/orig_pr_body.txt
NEW
=
/tmp/new_pr_body.txt
gh
pr
view
--json
body
--template
"{{.body}}"
"
${
PR_NUMBER
}
"
>
"
${
OLD
}
"
cp
"
${
OLD
}
"
"
${
NEW
}
"
# Remove all lines after and including "**BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE**"
sed
-i
'/\*\*BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE\*\*/,$d'
"
${
NEW
}
"
# Remove "FIX #xxxx (*link existing issues this PR will resolve*)"
sed
-i
'/FIX #xxxx.*$/d'
"
${
NEW
}
"
# Remove "FILL IN THE PR DESCRIPTION HERE"
sed
-i
'/FILL IN THE PR DESCRIPTION HERE/d'
"
${
NEW
}
"
# Run this only if ${NEW} is different than ${OLD}
if
!
cmp
-s
"
${
OLD
}
"
"
${
NEW
}
"
;
then
echo
"Updating PR body"
gh
pr
edit
--body-file
"
${
NEW
}
"
"
${
PR_NUMBER
}
"
else
echo
"No changes needed"
fi
.github/workflows/cleanup_pr_body.yml
0 → 100644
View file @
a2f1f3b0
name
:
Cleanup PR Body
on
:
pull_request
:
types
:
[
opened
,
edited
,
synchronize
]
jobs
:
update-description
:
runs-on
:
ubuntu-latest
steps
:
-
name
:
Checkout repository
uses
:
actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
# v4.2.1
-
name
:
Set up Python
uses
:
actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
# v5.2.0
with
:
python-version
:
'
3.12'
-
name
:
Update PR description
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
run
:
.github/scripts/cleanup_pr_body.sh "${{ github.event.number }}"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment