update-meta-repo #4
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: Update Meta Repo on PR Merge | |
| on: | |
| repository_dispatch: | |
| workflow_dispatch: | |
| jobs: | |
| update-meta-repo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the meta-repository | |
| run: | | |
| git clone --recurse-submodules https://x-access-token:${{ secrets.GH_PAT }}@github.com/hubspotdev/CODE-Hub.git | |
| cd CODE-Hub | |
| - name: Update submodules | |
| run: | | |
| cd CODE-Hub | |
| git submodule update --remote --merge | |
| - name: Extract repo and commit info | |
| run: | | |
| echo "REPO_NAME=${{ github.event.client_payload.repo }}" >> $GITHUB_ENV | |
| echo "COMMIT_HASH=${{ github.event.client_payload.commit }}" >> $GITHUB_ENV | |
| echo "PR_TITLE=${{ github.event.client_payload.pr_title }}" >> $GITHUB_ENV | |
| echo "PR_URL=${{ github.event.client_payload.pr_url }}" >> $GITHUB_ENV | |
| - name: Commit and push changes | |
| run: | | |
| cd CODE-Hub | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| # Generate a personalized commit message | |
| COMMIT_MESSAGE="Updated submodules after merge in $REPO_NAME | $PR_TITLE ($COMMIT_HASH) - $PR_URL" | |
| git add . | |
| git commit -m "$COMMIT_MESSAGE" || echo "No changes to commit" | |
| git push origin main |