Skip to content

Add workflow and workflow dist #1

Add workflow and workflow dist

Add workflow and workflow dist #1

Workflow file for this run

name: Distribute Workflows
on:
push:
paths:
- "wf1/**"
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')
echo "::set-output name=repos::$REPOS"
env:
TOKEN: ${{ secrets.GH_PAT }}
TOPIC: wf1
ORG: Galvanizer-Team
- name: Push to repositories with specific topic
run: |
for repo in ${{ steps.fetch-repos.outputs.repos }}; do
git clone "https://$TOKEN:x-oauth-basic@github.com/$repo.git"
# Create the .github/workflows directory if it doesn't exist
mkdir -p "$repo/.github/workflows"
cp -R wf1/* "$repo/.github/workflows/"
cd "$repo"
git add .github/workflows
git commit -m "Update workflows"
git push
cd ..
done
env:
TOKEN: ${{ secrets.GH_PAT }}