Add PR auto-open workflow (#1)
Deploy React Site / build-and-deploy (push) Successful in 37s
Deploy React Site / build-and-deploy (push) Successful in 37s
PR automatique de chore/update-deploy-for-cohaise vers main. --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #1 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #1.
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
name: Deploy React Site
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: esiah-s-universe
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Fetch Git LFS objects
|
||||||
|
run: |
|
||||||
|
git lfs install --local
|
||||||
|
AUTH="$(git config --local "http.${{ github.server_url }}/.extraheader")"
|
||||||
|
git config --local --unset "http.${{ github.server_url }}/.extraheader"
|
||||||
|
git config --local "http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader" "$AUTH"
|
||||||
|
git lfs pull
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- run: npm run build
|
||||||
|
|
||||||
|
- name: Verify no LFS pointer files remain
|
||||||
|
run: |
|
||||||
|
if grep -rl "git-lfs.github.com/spec/v1" dist/; then
|
||||||
|
echo "::error::LFS pointers found in dist/ - git-lfs was not fetched."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- run: rsync -av --delete dist/ /srv/apps/websites/esiah.dev/
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
name: PR — Ouverture automatique
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-pr:
|
||||||
|
runs-on: esiah-s-universe
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Ouvrir (ou vérifier) la pull request
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
API: ${{ github.server_url }}/api/v1
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
BRANCH: ${{ github.ref_name }}
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
if [ "$BRANCH" = "main" ]; then
|
||||||
|
echo "main est la base : aucune PR à ouvrir."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
title=$(git log -1 --pretty=%s)
|
||||||
|
body=$(git log -1 --pretty=%b)
|
||||||
|
[ -n "$body" ] || body="PR automatique de $BRANCH vers main."
|
||||||
|
|
||||||
|
open=$(curl -fsS -H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
"$API/repos/$REPO/pulls?state=open&limit=50" \
|
||||||
|
| python3 -c 'import json,os,sys; b=os.environ["BRANCH"]; print(sum(1 for p in json.load(sys.stdin) if p.get("head", {}).get("ref") == b))')
|
||||||
|
if [ "$open" -gt 0 ]; then
|
||||||
|
echo "Une PR est déjà ouverte pour $BRANCH."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3 - "$BRANCH" "$title" "$body" <<'PY' | curl -fsS -X POST \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data-binary @- \
|
||||||
|
"$API/repos/$REPO/pulls"
|
||||||
|
import json, sys
|
||||||
|
branch, title, body = sys.argv[1], sys.argv[2], sys.argv[3]
|
||||||
|
print(json.dumps({"base": "main", "head": branch, "title": title, "body": body}))
|
||||||
|
PY
|
||||||
|
echo "PR créée."
|
||||||
@@ -42,7 +42,7 @@ const cardData: CardDataItem[] = [
|
|||||||
image: "/images/projects/Coeur-UA-PAM.webp",
|
image: "/images/projects/Coeur-UA-PAM.webp",
|
||||||
description: "Web site of the Coeur UA PAM association.",
|
description: "Web site of the Coeur UA PAM association.",
|
||||||
label: "React Web site",
|
label: "React Web site",
|
||||||
link: "https://coeur-ua-pam.fr/",
|
link: "https://coeur-ua-pam.org/",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "About Co Hai Se",
|
title: "About Co Hai Se",
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export const reactWebItems = [
|
|||||||
{
|
{
|
||||||
id: "103",
|
id: "103",
|
||||||
img: "/images/projects/Coeur-UA-PAM.webp",
|
img: "/images/projects/Coeur-UA-PAM.webp",
|
||||||
link: "https://coeur-ua-pam.fr/",
|
link: "https://coeur-ua-pam.org/",
|
||||||
title: "Coeur UA PAM",
|
title: "Coeur UA PAM",
|
||||||
description: "Web site for Coeur UA PAM association.",
|
description: "Web site for Coeur UA PAM association.",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user