Update .gitea/workflows/deploy-ci.yaml
This commit is contained in:
@@ -156,14 +156,42 @@ jobs:
|
|||||||
url="$api/contents/$file"
|
url="$api/contents/$file"
|
||||||
sha=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$url" | jq -r '.sha // empty' || true)
|
sha=$(curl -sSL -H "Authorization: token ${{ secrets.TOKEN }}" "$url" | jq -r '.sha // empty' || true)
|
||||||
|
|
||||||
|
# author + committer used to avoid Gitea default 2001 date
|
||||||
|
author_name="GitHub Actions"
|
||||||
|
author_email="actions@github"
|
||||||
|
|
||||||
if [[ -z "$sha" ]]; then
|
if [[ -z "$sha" ]]; then
|
||||||
action="Add"
|
action="Add"
|
||||||
payload=$(jq -nc --arg message "$msg" --arg content "$content" --arg branch "$default_branch" \
|
payload=$(jq -nc \
|
||||||
'{message: $message, content: $content, branch: $branch}')
|
--arg message "$msg" \
|
||||||
|
--arg content "$content" \
|
||||||
|
--arg branch "$default_branch" \
|
||||||
|
--arg author_name "$author_name" \
|
||||||
|
--arg author_email "$author_email" '
|
||||||
|
{
|
||||||
|
message: $message,
|
||||||
|
content: $content,
|
||||||
|
branch: $branch,
|
||||||
|
author: { name: $author_name, email: $author_email },
|
||||||
|
committer: { name: $author_name, email: $author_email }
|
||||||
|
}')
|
||||||
else
|
else
|
||||||
action="Update"
|
action="Update"
|
||||||
payload=$(jq -nc --arg message "$msg" --arg content "$content" --arg sha "$sha" --arg branch "$default_branch" \
|
payload=$(jq -nc \
|
||||||
'{message: $message, content: $content, sha: $sha, branch: $branch}')
|
--arg message "$msg" \
|
||||||
|
--arg content "$content" \
|
||||||
|
--arg sha "$sha" \
|
||||||
|
--arg branch "$default_branch" \
|
||||||
|
--arg author_name "$author_name" \
|
||||||
|
--arg author_email "$author_email" '
|
||||||
|
{
|
||||||
|
message: $message,
|
||||||
|
content: $content,
|
||||||
|
sha: $sha,
|
||||||
|
branch: $branch,
|
||||||
|
author: { name: $author_name, email: $author_email },
|
||||||
|
committer: { name: $author_name, email: $author_email }
|
||||||
|
}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if curl -sSL --fail -X PUT -H "Authorization: token ${{ secrets.TOKEN }}" -H "Content-Type: application/json" \
|
if curl -sSL --fail -X PUT -H "Authorization: token ${{ secrets.TOKEN }}" -H "Content-Type: application/json" \
|
||||||
@@ -176,4 +204,4 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
run: rm -f "${{ env.REPO_LIST_FILE }}"
|
run: rm -f "${{ env.REPO_LIST_FILE }}"
|
||||||
Reference in New Issue
Block a user