Do not always require CODECOV_TOKEN #352
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Close trivial PRs | |
on: | |
pull_request_target: | |
types: [labeled] | |
jobs: | |
close-trivial-pr: | |
if: github.event.label.name == 'trivial' | |
runs-on: ubuntu-4 | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Fetch CONTRIBUTING.md snippet | |
id: snippet | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
SNIPPET=$(curl -sSfL "https://raw.githubusercontent.com/${REPO}/refs/heads/master/CONTRIBUTING.md" \ | |
| sed -n '/<!-- start-trivial-prs -->/,/<!-- end-trivial-prs -->/p' \ | |
| sed '/<!--.*-->/d') | |
# Use GitHub Actions heredoc-style output to preserve multiline content | |
echo "snippet<<EOF" >> $GITHUB_OUTPUT | |
echo "$SNIPPET" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Comment and Close PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
REPO=${{ github.repository }} | |
DEF_BRANCH=${{ github.event.repository.default_branch }} | |
SNIPPET="${{ steps.snippet.outputs.snippet }}" | |
gh pr close $PR_NUMBER --repo $REPO --comment \ | |
"Thank you for your contribution. However, this PR has been automatically closed because \ | |
it was labeled as **trivial**. As stated in our [CONTRIBUTING.md](../blob/${DEF_BRANCH}/CONTRIBUTING.md): | |
--- | |
${SNIPPET} | |
--- | |
We appreciate meaningful contributions!" |