Skip to content

Adding submodule bump automation#3921

Merged
ammallya merged 8 commits intomainfrom
users/ammallya/bump_submodule_automation
Mar 18, 2026
Merged

Adding submodule bump automation#3921
ammallya merged 8 commits intomainfrom
users/ammallya/bump_submodule_automation

Conversation

@ammallya
Copy link
Copy Markdown
Contributor

Motivation

Adding an automated workflow to manage submodule bumps for rocm-systems and rocm-libraries and to propagate corresponding reference updates back into those repositories.

  • Submodules are periodically updated to the latest upstream commits.
  • Workflow files in rocm-systems and rocm-libraries always reference the latest ROCm/TheRock commit.
  • Stale PRs created during the bump process are automatically cleaned up.

Technical Details

This change introduces a Python automation script and a GitHub Actions workflow.

Python Automation Script

A new script:

build_tools/github_actions/bump_automation.py

Scheduled (schedule)

Runs every 12 hours and performs the following:

  1. Retrieves the latest commit from:
    • ROCm/rocm-systems
    • ROCm/rocm-libraries
  2. Creates a new branch in ROCm/TheRock.
  3. Updates the corresponding submodule pointer.
  4. Opens a PR in ROCm/TheRock with the updated submodule reference.

Push

Triggered when ROCm/TheRock receives a push to the main branch.

The script:

  1. Detects whether either monitored submodule changed.
  2. Closes stale bump PRs related to the previous SHA.
  3. Updates ROCm/TheRock references in workflow YAML files in:
    • rocm-systems
    • rocm-libraries
  4. Creates a PR in the affected repository updating the ref: field.

Test Plan

Scheduled Run: https://github.com/ammallya/TheRock/pull/2

Push Event :
Stale PR close: https://github.com/ammallya/TheRock/pull/1
Update ref: https://github.com/ammallya/rocm-systems/pull/7 (Note date is also present added in the future)


Test Result

Results observed:

  • Submodule bump PRs were successfully created.
  • Stale PRs were automatically detected and closed.
  • Workflow files in rocm-systems and rocm-libraries were updated with the correct ROCm/TheRock commit reference.
  • Generated PRs included correct commit comparison links.

Submission Checklist

@ammallya
Copy link
Copy Markdown
Contributor Author

@copilot review this

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

@ammallya I've opened a new pull request, #3923, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automation to bump rocm-systems / rocm-libraries submodules in ROCm/TheRock, and to propagate TheRock ref: updates back into those upstream repos via PRs, driven by a scheduled + push-triggered GitHub Actions workflow.

Changes:

  • Add a new Python automation script to create/close PRs and rewrite workflow ref: pins.
  • Add a new GitHub Actions workflow to run the automation on a 12-hour schedule and on pushes to main.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 16 comments.

File Description
build_tools/github_actions/bump_automation.py Implements submodule bump PR creation, stale PR cleanup, and workflow ref: rewriting.
.github/workflows/bump_submodules.yml Adds schedule/push workflow to run the bump automation with GitHub App tokens.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread build_tools/github_actions/bump_automation.py Outdated
Comment thread build_tools/github_actions/bump_automation.py
Comment thread .github/workflows/bump_submodules.yml Outdated
Comment thread build_tools/github_actions/bump_automation.py
Comment thread build_tools/github_actions/bump_automation.py
Comment thread .github/workflows/bump_submodules.yml Outdated
Comment thread .github/workflows/bump_submodules.yml
Comment thread build_tools/github_actions/bump_automation.py
Comment thread build_tools/github_actions/bump_automation.py
Comment thread build_tools/github_actions/bump_automation.py
@ammallya ammallya marked this pull request as ready for review March 12, 2026 05:22
Comment thread build_tools/github_actions/bump_automation.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Marius Brehler <marius.brehler@gmail.com>
@ammallya ammallya requested a review from AmosLewis March 12, 2026 17:45
Comment thread .github/workflows/bump_submodules.yml Outdated
if: github.event_name == 'schedule'
run: |
python3 build_tools/github_actions/bump_automation.py \
--event_type schedule \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args value should be in double quotes

run(["git", "commit", "-m", f"Update TheRock ref to {after[:7]}"])
run(["git", "push", "origin", branch])
gh_api(
token,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This token is short-lived only but in case the push fails it be exposed as runtime error -- would want to run it by joseph on this as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/actions/create-github-app-token?tab=readme-ov-file#how-it-works

GitHub App tokens created using the create-github-app-token action get revoked as a post-job step, as documented in the link shared.

Copy link
Copy Markdown
Contributor

@rahulc-gh rahulc-gh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM , we can merge after discussing the token aspect with joseph

@ammallya ammallya merged commit 43032ba into main Mar 18, 2026
45 checks passed
@ammallya ammallya deleted the users/ammallya/bump_submodule_automation branch March 18, 2026 20:27
@github-project-automation github-project-automation Bot moved this from TODO to Done in TheRock Triage Mar 18, 2026
Comment on lines +9 to +11
push:
branches:
- main
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been failing on all pushes, fyi: https://github.com/ROCm/TheRock/actions/workflows/bump_submodules.yml?query=event%3Apush

https://github.com/ROCm/TheRock/actions/runs/23265484057/job/67645053372

Run actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
      
- ROCm/TheRock
Error: [@octokit/auth-app] appId option is required

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

chiranjeevipattigidi pushed a commit that referenced this pull request Mar 23, 2026
## Motivation

Adding an automated workflow to manage submodule bumps for
`rocm-systems` and `rocm-libraries` and to propagate corresponding
reference updates back into those repositories.

- Submodules are periodically updated to the latest upstream commits.
- Workflow files in `rocm-systems` and `rocm-libraries` always reference
the latest `ROCm/TheRock` commit.
- Stale PRs created during the bump process are automatically cleaned
up.

---

## Technical Details

This change introduces a Python automation script and a GitHub Actions
workflow.

### Python Automation Script

A new script:

build_tools/github_actions/bump_automation.py

#### Scheduled  (`schedule`)

Runs every 12 hours and performs the following:

1. Retrieves the latest commit from:
   - `ROCm/rocm-systems`
   - `ROCm/rocm-libraries`
2. Creates a new branch in `ROCm/TheRock`.
3. Updates the corresponding submodule pointer.
4. Opens a PR in `ROCm/TheRock` with the updated submodule reference.

#### Push 
Triggered when `ROCm/TheRock` receives a push to the `main` branch.

The script:

1. Detects whether either monitored submodule changed.
2. Closes stale bump PRs related to the previous SHA.
3. Updates `ROCm/TheRock` references in workflow YAML files in:
   - `rocm-systems`
   - `rocm-libraries`
4. Creates a PR in the affected repository updating the `ref:` field.

## Test Plan

Scheduled Run: https://github.com/ammallya/TheRock/pull/2

Push Event : 
Stale PR close: https://github.com/ammallya/TheRock/pull/1
Update ref: https://github.com/ammallya/rocm-systems/pull/7 (Note date
is also present added in the future)

---

## Test Result

Results observed:

- Submodule bump PRs were successfully created.
- Stale PRs were automatically detected and closed.
- Workflow files in `rocm-systems` and `rocm-libraries` were updated
with the correct `ROCm/TheRock` commit reference.
- Generated PRs included correct commit comparison links.

---

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Marius Brehler <marius.brehler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants