sync actions forks #257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: sync actions forks | |
#REQUIRES PAT WITH REPO(READ,WRITE) ORG(READ) WORKFLOWS(WRITE) | |
permissions: | |
contents: write | |
on: | |
schedule: | |
- cron: 0 1 * * * | |
workflow_dispatch: {} | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.repository, 'GeoNet/') == false }} | |
steps: | |
- name: require GeoNet org | |
run: | | |
exit 1 | |
sync-forks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: sync changes | |
id: sync-changes | |
env: | |
GH_TOKEN: ${{ secrets.GH_CI_USER_TOKEN }} | |
run: | | |
gh repo list geonet --no-archived --fork --json nameWithOwner --jq '.[].nameWithOwner' \ | |
| xargs -I{} gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/{} --template '{{.full_name}},{{.default_branch}}{{"\n"}}' \ | |
| xargs -I{} hack/update-forks.sh {} | |
shell: bash |