mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
chore: try to comment news item missing
chore: make news item check a comment
This commit is contained in:
parent
0acb256740
commit
a13a3af21f
1 changed files with 28 additions and 11 deletions
39
.github/workflows/check-news-item.yml
vendored
39
.github/workflows/check-news-item.yml
vendored
|
@ -1,10 +1,14 @@
|
|||
name: Check News Item
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -14,14 +18,27 @@ jobs:
|
|||
- id: file_changes
|
||||
uses: trilom/file-changes-action@v1.2.4
|
||||
with:
|
||||
output: ','
|
||||
- shell: bash
|
||||
output: ', '
|
||||
- shell: python
|
||||
id: check_news_item
|
||||
run: |
|
||||
added_files='${{ steps.file_changes.outputs.files_added}}'
|
||||
echo $added_files
|
||||
if [[ $added_files == *"news/"*.rst* ]]; then
|
||||
echo "Found news item for the PR"
|
||||
else
|
||||
echo "News item for the PR is not found. Please create one from 'news/TEMPLATE.rst'"
|
||||
exit 1
|
||||
fi
|
||||
from fnmatch import fnmatch
|
||||
added_files = "${{ steps.file_changes.outputs.files_added}}"
|
||||
if fnmatch(added_files, "*news/*.rst, *"):
|
||||
print("Found news item for the PR")
|
||||
else:
|
||||
print("News item for the PR is not found")
|
||||
print("::set-output name=NEWS_FOUND::false")
|
||||
# exit 1
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const news_found = ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}"
|
||||
if (news_found === 'false') {
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `News item for this PR is not found. Please create one from 'news/TEMPLATE.rst' if this is an user facing change/feature`
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue