diff --git a/.github/workflows/rocm.yml b/.github/workflows/rocm.yml new file mode 100644 index 0000000000..8bcb62575e --- /dev/null +++ b/.github/workflows/rocm.yml @@ -0,0 +1,76 @@ +name: Bump rocm-libraries submodule + +on: + pull_request: + workflow_dispatch: + schedule: + - cron: "0 11 * * *" + +permissions: + contents: write + pull-requests: write + +jobs: + bump-submodules: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 + with: + python-version: '3.12' + + - name: Configure Git Identity + run: | + git config --global user.name "therockbot" + git config --global user.email "therockbot@amd.com" + + - name: Set branch name + id: set-branch + run: | + DATE=$(date +%Y%m%d) + BRANCH="github-action/bump-rocm-libraries-submodule-$DATE" + echo "branch-name=$BRANCH" >> $GITHUB_OUTPUT + + - name: Run bump_submodules.py + run: | + CMD="python3 ./build_tools/bump_submodules.py --push-branch --branch-name ${{ steps.set-branch.outputs.branch-name }} --components rocm-libraries" + echo "Running command: $CMD" + eval $CMD + + - name: Prepare PR body with diff info + run: | + echo "Automated daily submodule bump" > pr_body.txt + echo "This PR was automatically created by a GitHub App to update submodules." >> pr_body.txt + echo "" >> pr_body.txt + git fetch origin main + echo "## Submodule changes" >> pr_body.txt + echo "" >> pr_body.txt + git diff origin/main ${{ steps.set-branch.outputs.branch-name }} | \ + grep -E '^diff --git |^\+\+\+|^---|^\+Subproject commit|^-Subproject commit' | \ + sed \ + -e 's/^diff --git/### diff --git/g' \ + -e 's/^---/Old path:/g' \ + -e 's/^\+\+\+/New path:/g' \ + -e 's/^-Subproject commit/ Old commit:/g' \ + -e 's/^\+Subproject commit/ New commit:/g' \ + >> pr_body.txt + echo "" >> pr_body.txt + + - name: Generate GitHub App token + uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 + id: generate-token + with: + app-id: ${{ secrets.PULL_REQUEST_APP_ID }} + private-key: ${{ secrets.PULL_REQUEST_APP_KEY }} + + - name: Create pull request + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + run: | + DATE=$(date +%Y%m%d) + gh pr create \ + --base main \ + --head ${{ steps.set-branch.outputs.branch-name }} \ + --title "rocm-libraries Submodule Bump-$DATE" \ + --body-file pr_body.txt