Files
awesome-jellyfin/.github/workflows/sorting-pull-check.yaml

87 lines
2.3 KiB
YAML

name: 'README Update Pull Request'
on:
# pull_request:
# paths:
# - 'README.md'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Install Sorter
run: |
go install github.com/awesome-jellyfin/clients-md-generator/cmd/sort@v1.0.1
- name: Sort README
id: sorting
run: |
go run github.com/awesome-jellyfin/clients-md-generator/cmd/sort@v1.0.1 \
-input README.md \
-out-file README.sorted.md \
-out-stdout \
-fail
continue-on-error: true
- name: Generate Comment Body on Failure
if: steps.sorting.outcome == 'failure'
run: |
cat <<EOF > comment_body.txt
<!-- [sort-result] -->
**Thank you for your contribution! ❤️**
We found sorting changes in <code>README.md</code>.
Here is a diff showing what changed:
<details>
<summary><code>README.md</code> diff</summary>
\`\`\`diff
$(diff -u README.md README.sorted.md || true)
\`\`\`
</details>
EOF
- name: Generate Comment Body on Success
if: steps.sorting.outcome != 'failure'
run: |
cat <<EOF > comment_body.txt
<!-- [sort-result] -->
**Thank you for your contribution! ❤️**
No issues found with the ordering.
EOF
- name: Find Comment from Linter
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: 'awesome-jellyfin-bot'
body-includes: '<!-- [sort-result] -->'
- name: Create or Update Sorting Diff Comment
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.AWESOME_JELLYFIN_BOT_TOKEN }}
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body-path: comment_body.txt
edit-mode: replace
- name: Fail if sorting changed
if: steps.sorting.outcome == 'failure'
run: |
echo "README.md requires sorting. Failing the pipeline."
exit 1