Skip to content

Another fix

Another fix #6

Workflow file for this run

name: Distribute Workflows
on:
push:
branches:
- main
permissions:
contents: write
issues: write
jobs:
update-workflows:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Fetch repositories with specific topic
id: fetch-repos
run: |
REPOS=$(curl -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:$TOPIC+org:$ORG \
| jq -r '.items[].full_name' | tr '\n' ' ') # Convert newline to space
echo "Fetched Repositories: $REPOS"
echo "REPOS=$REPOS" >> $GITHUB_ENV
env:
TOKEN: ${{ secrets.GH_PAT }}
TOPIC: wf1
ORG: Galvanizer-Team
- name: Push to repositories with specific topic
run: |
# Configure Git Identity
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
# Convert space-separated list back to array
IFS=' ' read -ra REPO_ARRAY <<< "$REPOS"
for repo in "${REPO_ARRAY[@]}"; do
# git clone "https://$TOKEN:x-oauth-basic@github.com/$repo.git"
git clone "https://x-access-token:$TOKEN@github.com/$repo.git"
mkdir -p "$repo/.github/workflows"
cp -R wf1/* "$repo/.github/workflows/"
cd "$repo"
git add .github/workflows
git commit -m "Update workflows | #none"
git remote set-url origin "https://x-access-token:$TOKEN@github.com/$repo.git"
git push origin main
cd ..
done
env:
TOKEN: ${{ secrets.GH_PAT }}