Update Automation #8
Workflow file for this run
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 Automation | |
| on: | |
| # schedule: | |
| # - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update-automation: | |
| name: Run Automation Tasks | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Check if update needed | |
| run: | | |
| cd third-party-src | |
| git fetch --tags | |
| CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null | head -1) | |
| if [ -z "$CURRENT_TAG" ]; then | |
| echo "Error: Submodule is not on a tagged commit" | |
| exit 1 | |
| fi | |
| cd .. | |
| LATEST_TAG=$(curl -L \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/microsoft/vscode/releases/latest | jq -r '.tag_name') | |
| echo "Current tag: $CURRENT_TAG" | |
| echo "Latest tag: $LATEST_TAG" | |
| if [ "$CURRENT_TAG" = "$LATEST_TAG" ]; then | |
| echo "Submodule is up to date with latest VS Code release" | |
| exit 0 | |
| else | |
| echo "Update needed: $CURRENT_TAG -> $LATEST_TAG" | |
| # Create staging branch | |
| STAGING_BRANCH="staging-code-editor-$LATEST_TAG" | |
| echo "Creating staging branch: $STAGING_BRANCH" | |
| git checkout -b "$STAGING_BRANCH" | |
| # Update submodule to latest VS Code release | |
| echo "Updating submodule to $LATEST_TAG" | |
| cd third-party-src | |
| git fetch --tags | |
| git checkout "$LATEST_TAG" | |
| cd .. | |
| echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | |
| echo "STAGING_BRANCH=$STAGING_BRANCH" >> $GITHUB_ENV | |
| fi | |
| - name: Commit and push changes | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| add: 'third-party-src' | |
| message: 'Update VS Code submodule to ${{ env.LATEST_TAG }}' | |
| new_branch: ${{ env.STAGING_BRANCH }} | |
| default_author: github_actions | |