Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions .github/workflows/casaos-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,33 @@ jobs:
base-url: https://libredb.org/casaos-store

- name: Open a pull request with the output when it changed
# It opens a pull request rather than pushing. 1 Nov: the push step failed on
# every run with `GH013: Changes must be made through a pull request`, so the
# store the site served stayed at the version it was built with while
# casaos-store/ moved on. A workflow that cannot write its own output silently
# is worse than one that asks for a review.
# It opens a pull request rather than pushing to main. 1 Nov: the push step
# failed on every run with `GH013: Changes must be made through a pull
# request`, so the store the site served stayed at the version it was first
# built with while casaos-store/ moved on.
#
# `git diff --quiet` still decides, so an unchanged build opens nothing: the
# build rewrites every file each run, and an unconditional pull request would
# open an empty-looking one on every push.
id: fark
# Plain git and `gh` rather than an action: the first attempt used
# peter-evans/create-pull-request, whose git push answered HTTP 400 here.
#
# `git diff --quiet` decides, so an unchanged build opens nothing: the build
# rewrites every file each run, and an unconditional pull request would open
# an empty-looking one on every push.
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if git diff --quiet -- public/casaos-store; then
echo "::notice::The generated store is unchanged."
echo "degisti=false" >> "$GITHUB_OUTPUT"
else
echo "degisti=true" >> "$GITHUB_OUTPUT"
exit 0
fi
dal="casaos-store/rebuild-${GITHUB_RUN_ID}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "$dal"
git add public/casaos-store
git commit -m "chore(casaos-store): rebuild the generated store"
git push origin "$dal"
gh pr create --base "${GITHUB_REF_NAME}" --head "$dal" \
--title "chore(casaos-store): rebuild the generated store" \
--body "The CasaOS Store workflow rebuilt \`public/casaos-store\` from \`casaos-store/\`.

- name: Create the pull request
if: steps.fark.outputs.degisti == 'true'
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
add-paths: public/casaos-store
branch: casaos-store/rebuild
delete-branch: true
commit-message: "chore(casaos-store): rebuild the generated store"
title: "chore(casaos-store): rebuild the generated store"
body: |
The CasaOS Store workflow rebuilt `public/casaos-store` from `casaos-store/`.

Merging this publishes the rebuilt store the next time the site deploys.
Merging this publishes the rebuilt store the next time the site deploys."
Loading