Skip to content

Commit

Permalink
Merge pull request #77 from hatena/update-blogsync-v0.20.1
Browse files Browse the repository at this point in the history
Update blogsync v0.20.1
  • Loading branch information
halkt authored Apr 11, 2024
2 parents 51715f7 + 6ff3c0d commit 9ebc4d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
- name: setup blogsync
uses: x-motemen/blogsync@v0
with:
version: v0.18.2
version: v0.20.1
- name: restore mtime
run: |
git restore-mtime
Expand Down
23 changes: 1 addition & 22 deletions .github/workflows/push-when-publishing-from-draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,13 @@ jobs:
with:
files: draft_entries/**/*.md
since_last_remote_commit: true
- name: blogsync push and delete file
- name: blogsync push
id: publised-from-draft
run: |
published_from_draft_edit_urls=()
for file in ${{ steps.changed-draft-files.outputs.all_changed_files }}; do
draft=$(yq --front-matter=extract 'select(.Draft == true)' "$file")
if [[ -z "$draft" ]]; then
blogsync push "$file"
published_from_draft_edit_urls+=($(yq '.EditURL' --front-matter=extract "$file"))
rm "$file"
fi
done
echo "PUBLISHED_FROM_DRSFT_EDIT_URLS=${published_from_draft_edit_urls[@]}" >> $GITHUB_OUTPUT
- name: set blog domain
id: set-domain
run: |
domain="${{ inputs.BLOG_DOMAIN }}"
echo "BLOG_DOMAIN=$(echo $domain | tr -d '\n\r ')" >> "$GITHUB_OUTPUT"
- name: pull
run: |
blogsync pull ${{ steps.set-domain.outputs.BLOG_DOMAIN }}
- name: delete other files
run: |
files=($(git ls-files -o --exclude-standard))
for file in ${files[@]}; do
editurl=$(yq '.EditURL' --front-matter=extract $(echo $file))
if printf '%s\n' "${{ steps.publised-from-draft.outputs.PUBLISHED_FROM_DRSFT_EDIT_URLS }}" | grep -qvx "$editurl"; then
rm "$file"
fi
done
- name: create pull request
Expand Down

0 comments on commit 9ebc4d4

Please sign in to comment.