59 строки
2.4 KiB
YAML
59 строки
2.4 KiB
YAML
name: Setup additonal release subtrees for super-repo
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
SUPER_REPO_URL: github.com/ROCm/rocm-systems.git
|
|
SUPER_REPO_BRANCH: release/rocm-rel-7.0
|
|
|
|
jobs:
|
|
setup-super-repo:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Validate maintainer permissions
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
echo "Actor is: ${{ github.actor }}"
|
|
PERMISSION=$(gh api \
|
|
repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission \
|
|
--jq .permission)
|
|
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
|
|
echo "❌ User ${{ github.actor }} is not authorized to run this workflow"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Generate a token
|
|
id: generate-token
|
|
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
|
|
with:
|
|
app-id: ${{ secrets.APP_ID }}
|
|
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
|
|
- name: Checkout the Super-repo
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
ref: ${{ env.SUPER_REPO_BRANCH }}
|
|
|
|
- name: Set up Git user and Git LFS
|
|
run: |
|
|
git config user.name "systems-assistant[bot]"
|
|
git config user.email "systems-assistant[bot]@users.noreply.github.com"
|
|
|
|
- name: Add Repositories to the Super-repo
|
|
run: |
|
|
for repo in $(cat .github/repos-added-config-release.json | jq -r '.repositories[].name'); do
|
|
repo_name=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .reponame")
|
|
url=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .url")
|
|
branch=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .branch")
|
|
category=$(cat .github/repos-added-config-release.json | jq -r ".repositories[] | select(.name == \"$repo\") | .category")
|
|
|
|
git subtree add --prefix "${category}/${repo}" https://github.com/${url}.git "$branch"
|
|
done
|
|
|
|
- name: Push changes to Super-repo
|
|
run: git push https://${{ env.SUPER_REPO_URL }} ${{ env.SUPER_REPO_BRANCH }}
|