Bump submodule conditionally #19
This file contains hidden or 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: Bump submodule conditionally | |
| on: | |
| schedule: | |
| - cron: "0 6 * * 1" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| bump-submodule: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| submodules: false | |
| - name: List used submodule paths | |
| run: | | |
| chmod +x scripts/list-used-submodule-paths.sh | |
| scripts/list-used-submodule-paths.sh | cat | |
| - name: Determine candidate updates and push branch | |
| id: bump | |
| run: | | |
| chmod +x scripts/bump-submodules-conditionally.sh | |
| scripts/bump-submodules-conditionally.sh || true | |
| BRANCH=$(cat .tmp_branch_name 2>/dev/null || echo "") | |
| if [[ -n "$BRANCH" ]]; then | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create PR from pushed branch | |
| if: steps.bump.outputs.skip == 'false' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| BRANCH="${{ steps.bump.outputs.branch }}" | |
| BASE_BRANCH="${{ github.event.repository.default_branch }}" | |
| echo "Creating PR from $BRANCH -> $BASE_BRANCH" | |
| # If an open PR already exists for this branch, skip creating a new one | |
| if gh pr view "$BRANCH" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | |
| echo "PR already exists for $BRANCH; skipping creation." | |
| exit 0 | |
| fi | |
| gh pr create \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --head "$BRANCH" \ | |
| --base "$BASE_BRANCH" \ | |
| --title "chore: bump submodules conditionally" \ | |
| --body-file .tmp_pr_body.md || true | |