Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0c6976a95 | ||
| a674163f7f | |||
|
|
a52d95e620 | ||
|
|
fdc5b46ef3 | ||
| 7aa47b74b9 | |||
| fa056218d8 | |||
|
|
c4cb329139 | ||
| e30591b584 |
@@ -5,9 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
|
||||||
- cron: "28 5 * * *"
|
|
||||||
# workflow_run support in Gitea can be tricky, keeping it but might need adjustment
|
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows: ["Sync Repo"]
|
workflows: ["Sync Repo"]
|
||||||
types:
|
types:
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
name: Update README
|
name: Update README
|
||||||
|
|
||||||
# Allow GitHub Actions to commit and push changes
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 4 * * *' # Every day at 4 AM UTC
|
- cron: "0 4 * * *" # Every day at 4 AM UTC
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-readme:
|
update-readme:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SOURCE_REPO: ivancarlosti/.github
|
SOURCE_REPO: ivancarlos/.gitea
|
||||||
SOURCE_BRANCH: main
|
SOURCE_BRANCH: main
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -26,53 +27,33 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repository: ${{ env.SOURCE_REPO }}
|
repository: ${{ env.SOURCE_REPO }}
|
||||||
ref: ${{ env.SOURCE_BRANCH }}
|
ref: ${{ env.SOURCE_BRANCH }}
|
||||||
|
token: ${{ secrets.CR_PAT }}
|
||||||
path: source_readme
|
path: source_readme
|
||||||
|
|
||||||
- name: Update README.md (buttons and footer)
|
- name: Update README.md (footer only)
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
REPO_NAME="${GITHUB_REPOSITORY##*/}"
|
|
||||||
|
|
||||||
# --- Extract buttons block from source ---
|
|
||||||
BUTTONS=$(awk '/<!-- buttons -->/{flag=1;next}/<!-- endbuttons -->/{flag=0}flag' source_readme/README.md)
|
|
||||||
BUTTONS_UPDATED=$(echo "$BUTTONS" | sed "s/\.github/${REPO_NAME}/g")
|
|
||||||
|
|
||||||
# --- Extract footer block from source (everything from <!-- footer --> onward) ---
|
# --- Extract footer block from source (everything from <!-- footer --> onward) ---
|
||||||
FOOTER=$(awk '/<!-- footer -->/{flag=1}flag' source_readme/README.md)
|
FOOTER=$(awk '/<!-- footer -->/{flag=1}flag' source_readme/README.md)
|
||||||
|
|
||||||
# --- Replace buttons section in README.md ---
|
|
||||||
UPDATED=$(awk -v buttons="$BUTTONS_UPDATED" '
|
|
||||||
BEGIN { skip=0 }
|
|
||||||
/<!-- buttons -->/ {
|
|
||||||
print
|
|
||||||
print buttons
|
|
||||||
skip=1
|
|
||||||
next
|
|
||||||
}
|
|
||||||
/<!-- endbuttons -->/ && skip {
|
|
||||||
print
|
|
||||||
skip=0
|
|
||||||
next
|
|
||||||
}
|
|
||||||
!skip { print }
|
|
||||||
' README.md)
|
|
||||||
|
|
||||||
# --- Replace everything after <!-- footer --> with FOOTER ---
|
# --- Replace everything after <!-- footer --> with FOOTER ---
|
||||||
echo "$UPDATED" | awk -v footer="$FOOTER" '
|
awk -v footer="$FOOTER" '
|
||||||
/<!-- footer -->/ {
|
/<!-- footer -->/ {
|
||||||
print footer
|
print footer
|
||||||
found=1
|
found=1
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
{ print }
|
{ print }
|
||||||
' > README.tmp && mv README.tmp README.md
|
' README.md > README.tmp && mv README.tmp README.md
|
||||||
|
|
||||||
- name: Remove source_readme from git index
|
- name: Remove source_readme from git index
|
||||||
run: git rm --cached -r source_readme || true
|
run: rm -rf source_readme
|
||||||
|
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
run: |
|
||||||
with:
|
git config user.name "Gitea Actions"
|
||||||
file_pattern: README.md
|
git config user.email "actions@git.icc.gg"
|
||||||
commit_message: "Sync README from template [▶️]"
|
git add README.md
|
||||||
branch: ${{ github.ref_name }}
|
git commit -m "Sync README from template [▶️]" || echo "Nothing to commit"
|
||||||
|
git push origin ${{ github.ref_name }}
|
||||||
|
|||||||
@@ -35,14 +35,7 @@ docker compose pull && docker compose up -d
|
|||||||
[**buying me a coffee**][buymeacoffee], [**donate by paypal**][paypal], [**sponsor this project**][sponsor] or just [**leave a star**](../..)⭐
|
[**buying me a coffee**][buymeacoffee], [**donate by paypal**][paypal], [**sponsor this project**][sponsor] or just [**leave a star**](../..)⭐
|
||||||
|Thanks for your support, it is much appreciated!|
|
|Thanks for your support, it is much appreciated!|
|
||||||
|
|
||||||
[cc]: https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project
|
[ivancarlos]: https://ivancarlos.me
|
||||||
[contributing]: https://docs.github.com/en/articles/setting-guidelines-for-repository-contributors
|
|
||||||
[security]: https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository
|
|
||||||
[support]: https://docs.github.com/en/articles/adding-support-resources-to-your-project
|
|
||||||
[it]: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
|
||||||
[prt]: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository
|
|
||||||
[funding]: https://docs.github.com/en/articles/displaying-a-sponsor-button-in-your-repository
|
|
||||||
[ivancarlos]: https://ivancarlos.it
|
|
||||||
[buymeacoffee]: https://www.buymeacoffee.com/ivancarlos
|
[buymeacoffee]: https://www.buymeacoffee.com/ivancarlos
|
||||||
[paypal]: https://icc.gg/donate
|
[paypal]: https://icc.gg/donate
|
||||||
[sponsor]: https://github.com/sponsors/ivancarlosti
|
[sponsor]: https://github.com/sponsors/ivancarlosti
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"version": "7.1.5",
|
"version": "7.2.0",
|
||||||
"author": "Ivan Carlos"
|
"author": "Ivan Carlos"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user