Skip to content

Commit 0acf7ff

Browse files
authored
Test
1 parent 21d5f87 commit 0acf7ff

File tree

1 file changed

+12
-64
lines changed

1 file changed

+12
-64
lines changed

.github/workflows/prepare-release.yml

Lines changed: 12 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -50,70 +50,18 @@ jobs:
5050
RUNGHA_APP_SLUG: ${{ steps.app-token.outputs.app-slug }} # just for defense against script injection
5151
RUNGHA_USER_ID: ${{ steps.get-user-id.outputs.user-id }} # just for defense against script injection
5252

53-
- name: Debug App installation token
53+
- name: Push branch to ci-cd-test
5454
run: |
55-
echo "➡️ Repos accessibles par cette installation :"
56-
gh api /installation/repositories --jq '.repositories[].full_name'
57-
echo
58-
echo "➡️ Vérification accès à ci-cd-test :"
59-
gh api /repos/gridsuite/ci-cd-test || echo "❌ Pas d'accès"
60-
env:
61-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
62-
63-
- name: Load repo list from file or input
64-
id: load_repos
65-
run: |
66-
if [[ -z "${{ github.event.inputs.repos_to_release }}" ]]; then
67-
echo "ℹ️ No user input → load .github/config/repos-to-release.txt"
68-
list="$(cat .github/config/repos-to-release.txt)"
69-
else
70-
echo "ℹ️ Input found → load user input"
71-
list="${{ github.event.inputs.repos_to_release }}"
72-
fi
73-
echo "list<<EOF" >> $GITHUB_OUTPUT
74-
echo "$list" >> $GITHUB_OUTPUT
75-
echo "EOF" >> $GITHUB_OUTPUT
76-
77-
- name: Extract last commit date (last friday 23:59 UTC if left empty)
78-
id: load_date
79-
run: |
80-
if [ -z "${{ github.event.inputs.target_date }}" ]; then
81-
date_value=$(date -u -d "last friday 23:59" +"%Y-%m-%dT%H:%M:%SZ")
82-
else
83-
date_value="${{ github.event.inputs.target_date }}"
84-
fi
85-
echo "date_value=$date_value" >> $GITHUB_OUTPUT
86-
echo "This limit date will be used : $date_value"
55+
TOKEN=${{ steps.auth.outputs.token }}
56+
REPO=gridsuite/ci-cd-test
57+
BRANCH=test-branch
8758
88-
- name: Lister les SHAs des commits
89-
run: |
90-
mkdir public_repos
91-
cd public_repos
92-
93-
while read url; do
94-
url_with_token="${url/https:\/\/github.com/https:\/\/x-access-token:${TOKEN}@github.com}"
95-
git clone "$url_with_token"
96-
folder=$(basename "$url" .git)
97-
cd $folder
98-
commit_date="${{ steps.load_date.outputs.date_value }}"
99-
commit_hash=$(git rev-list -n 1 --before="$commit_date" main)
100-
git checkout $commit_hash
101-
102-
branch_name="prepare-release-${{github.event.inputs.release-version}}"
103-
# Check if *branch_name* already exists
104-
if git ls-remote --exit-code origin "refs/heads/$branch_name"; then
105-
echo "❌ Warning for $folder: Branch $branch_name already exists"
106-
fi
107-
git checkout -b "$branch_name"
59+
echo "Cloning $REPO"
60+
git clone --depth 1 https://x-access-token:[email protected]/$REPO.git
61+
cd ci-cd-test
10862
109-
if ! git push origin "$branch_name"; then
110-
echo "❌ Error for $folder: Failed to push $branch_name"
111-
fi
112-
113-
commit_message=$(git log -1 --pretty=%s | cut -c1-50)
114-
115-
echo "✅ $folder : $branch_name branch created → $commit_hash | $commit_message"
116-
cd - > /dev/null
117-
done <<< "${{ steps.load_repos.outputs.list }}"
118-
env:
119-
TOKEN: ${{ steps.app-token.outputs.token }}
63+
echo "File updated from central workflow at $(date)" > central-update.txt
64+
git checkout -b $BRANCH
65+
git add central-update.txt
66+
git commit -m "Central workflow test push"
67+
git push origin $BRANCH

0 commit comments

Comments
 (0)