Skip to content

Commit 7a97f59

Browse files
authored
Merge pull request #26 from camaraproject/test_workflow_update
Update repository setup workflow
2 parents cce996e + 6767e0a commit 7a97f59

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/setup-new-repo.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,41 @@ jobs:
189189
-F message='Update README.md with project metadata' \
190190
-F content="$(base64 -w 0 README.md)" \
191191
-F sha="$SHA"
192+
193+
- name: Update issue template config placeholders
194+
run: |
195+
# Update .github/ISSUE_TEMPLATE/config.yml placeholders
196+
CONFIG_FILE=".github/ISSUE_TEMPLATE/config.yml"
197+
if [ -f "$CONFIG_FILE" ]; then
198+
echo "Updating $CONFIG_FILE placeholders..."
199+
sed -i "s/{{repo_name}}/$REPO_NAME/g" $CONFIG_FILE
200+
201+
# Wait for the config.yml file to be available in the new repository
202+
CONFIG_SHA=""
203+
for i in {1..5}; do
204+
CONFIG_SHA=$(gh api repos/$OWNER/$REPO_NAME/contents/$CONFIG_FILE 2>/dev/null | jq -r '.sha')
205+
if [ "$CONFIG_SHA" != "null" ] && [ -n "$CONFIG_SHA" ]; then
206+
echo "Found $CONFIG_FILE sha: $CONFIG_SHA"
207+
break
208+
else
209+
echo "$CONFIG_FILE not yet available, retrying in 2s..."
210+
sleep 2
211+
fi
212+
done
213+
214+
if [ "$CONFIG_SHA" != "null" ] && [ -n "$CONFIG_SHA" ]; then
215+
gh api repos/$OWNER/$REPO_NAME/contents/$CONFIG_FILE \
216+
-X PUT \
217+
-F message="Update $CONFIG_FILE with project metadata" \
218+
-F content="$(base64 -w 0 $CONFIG_FILE)" \
219+
-F sha="$CONFIG_SHA"
220+
echo "Successfully updated $CONFIG_FILE"
221+
else
222+
echo "::warning::Could not find $CONFIG_FILE in the repository. Skipping update."
223+
fi
224+
else
225+
echo "::warning::$CONFIG_FILE not found in template. Skipping update."
226+
fi
192227
193228
- name: Set team permissions
194229
run: |

0 commit comments

Comments
 (0)