Skip to content

refactor(fabric-items): use generic impl #583

refactor(fabric-items): use generic impl

refactor(fabric-items): use generic impl #583

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: πŸ”„ Changelog
on:
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
workflow_dispatch:
concurrency:
group: ${{ format('{0}-{1}-{2}-{3}-{4}', github.workflow, github.event_name, github.ref, github.base_ref || null, github.head_ref || null) }}
cancel-in-progress: true
permissions:
contents: read
issues: write
pull-requests: write
jobs:
changelog-existence:
name: πŸ”„ Check Changelog
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-changelog') && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: ‡️ Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: βœ”οΈ Check if changelog file was added
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changelog_check
with:
filters: |
exists:
- added|modified: '.changes/unreleased/**.yaml'
- name: 🚧 Setup Go
if: steps.changelog_check.outputs.exists == 'true'
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: go.mod
cache: true
- name: 🚧 Setup Task
if: steps.changelog_check.outputs.exists == 'true'
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
with:
repo-token: ${{ github.token }}
- name: 🚧 Setup Changie
if: steps.changelog_check.outputs.exists == 'true'
run: task install:changie
- name: πŸ”Ž Find comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: "<!-- changelog -->"
- name: πŸ”„ Prepare comment (changelog)
if: steps.changelog_check.outputs.exists == 'true'
run: |
echo -e "# Changelog Preview\n" > changie.md
changie batch patch --dry-run --prerelease 'dev' >> changie.md
cat changie.md >> $GITHUB_STEP_SUMMARY
echo -e "\n<!-- changelog -->" >> changie.md
env:
CHANGIE_GITHUB_REPOSITORY: ${{ github.repository }}
- name: πŸ“ Create comment (changelog)
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
if: steps.changelog_check.outputs.exists == 'true' && steps.fc.outputs.comment-id == ''
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: changie.md
- name: πŸ“ Update comment (changelog)
if: steps.changelog_check.outputs.exists == 'true' && steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body-path: changie.md
edit-mode: replace
- name: πŸ”„ Prepare comment (missing)
if: steps.changelog_check.outputs.exists == 'false'
run: |
echo -e "# πŸ›‘ Changelog entry required to merge\n" > changie.md
echo "Run \`changie new\` to add a new changelog entry" >> changie.md
cat changie.md >> $GITHUB_STEP_SUMMARY
echo -e "\n<!-- changelog -->" >> changie.md
- name: πŸ“ Create comment (missing)
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
if: steps.changelog_check.outputs.exists == 'false' && steps.fc.outputs.comment-id == ''
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: changie.md
- name: πŸ“ Update comment (missing)
if: steps.changelog_check.outputs.exists == 'false' && steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body-path: changie.md
edit-mode: replace
- name: βœ… Pass if changelog entry exists
if: steps.changelog_check.outputs.exists == 'true'
run: |
echo "βœ… Changelog entry exists."
exit 0
- name: πŸ›‘ Fail if changelog entry is missing and required
if: steps.changelog_check.outputs.exists == 'false'
run: |
echo "πŸ›‘ Changelog entry required to merge."
exit 1
changelog-skip:
name: πŸ”„ Check Changelog
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changelog') || github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: πŸ”Ž Find comment
if: github.actor != 'dependabot[bot]'
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: "<!-- changelog -->"
- name: πŸ—‘οΈ Delete comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: github.actor != 'dependabot[bot]' && steps.fc.outputs.comment-id != ''
with:
script: |
github.rest.issues.deleteComment({
...context.repo,
comment_id: ${{ steps.fc.outputs.comment-id }},
});
- name: βœ… Pass (skip)
run: exit 0