99 target_date :
1010 description : " Date of last commit to inlude (ISO 8601, ex: 2024-09-13T23:59:59Z - default : last friday 23:59:59)."
1111 required : false
12+ release-version :
13+ description : " Version for new tag (ex: v2.8.0)"
14+ required : true
1215
1316jobs :
14- list-shas :
17+ prepare-release :
1518 runs-on : ubuntu-latest
1619 steps :
1720 - name : Checkout aggregator repository
3841 echo "EOF" >> $GITHUB_OUTPUT
3942
4043 - name : Extract last commit date (last friday 23:59 UTC if left empty)
41- id : date
44+ id : load_date
4245 run : |
4346 if [ -z "${{ github.event.inputs.target_date }}" ]; then
4447 date_value=$(date -u -d "last friday 23:59" +"%Y-%m-%dT%H:%M:%SZ")
@@ -50,28 +53,32 @@ jobs:
5053
5154 - name : Lister les SHAs des commits
5255 run : |
56+ mkdir public_repos
57+ cd public_repos
58+
5359 while read url; do
54- if [[ "$url" =~ github.com[:/]+([^/]+)/([^/]+)(\.git)?$ ]]; then
55- org="${BASH_REMATCH[1]}"
56- repo="${BASH_REMATCH[2]}"
57- repo="${repo%.git}"
58- else
59- echo "❌ Could not parse repository url : $url"
60- continue
61- fi
62- commit=$(gh api repos/$org/$repo/commits \
63- --method GET \
64- -f until="2025-09-12T23:59:00Z" \
65- -F per_page=1 \
66- --jq '.[0] | {sha: .sha, message: .commit.message}')
60+ git clone $url
61+ folder=$(basename "$url" .git)
62+ cd $folder
63+ commit_date='${{ steps.load_date.outputs.date_value }}''
64+ commit_hash=$(git rev-list -n 1 --before="$commit_date" main)
65+ git checkout $commit_hash
6766
68- sha=$(echo "$commit" | jq -r .sha | cut -c1-7)
69- msg=$(echo "$commit" | jq -r .message | head -n1 | cut -c1-60)
67+ branch_name="prepare-release-${{github.event.inputs.release-version}}"
68+ # Check if *branch_name* already exists
69+ if git show-ref --verify --quiet "refs/heads/$branch_name"; then
70+ echo "❌ Warning for $folder: Branch $branch_name already exists"
71+ exit 1
72+ fi
73+ git checkout -b "$branch_name"
7074
71- if [[ -z "$sha" || "$sha" == "null" ]] ; then
72- echo "❌ Aucun commit trouvé pour $repo avant last friday "
73- continue
75+ if ! git push origin "$branch_name" ; then
76+ echo "❌ Error for $folder: Failed to push $branch_name "
77+ exit 1
7478 fi
7579
76- echo "✅ $repo → $sha | $msg"
80+ commit_message=$(git log -1 --pretty=%s | cut -c1-50)
81+
82+ echo "✅ $folder tagged → $commit_hash | $commit_message"
83+ cd - > /dev/null
7784 done <<< "${{ steps.load_repos.outputs.list }}"
0 commit comments