etcdmain: centralize exit handling #608
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: Bump devcontainer version | |
| on: pull_request | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| jobs: | |
| dependabot-metadata: | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'etcd-io/etcd' | |
| outputs: | |
| directory: ${{steps.metadata.outputs.directory}} | |
| new-version: ${{steps.metadata.outputs.new-version}} | |
| steps: | |
| - name: Dependabot metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 | |
| with: | |
| github-token: "${{secrets.GITHUB_TOKEN}}" | |
| devcontainer-update: | |
| runs-on: ubuntu-latest | |
| needs: dependabot-metadata | |
| if: needs.dependabot-metadata.outputs.directory == '/tools/container-images/devcontainer' | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| ref: ${{github.event.pull_request.head.ref}} | |
| repository: ${{github.event.pull_request.head.repo.full_name}} | |
| fetch-depth: 0 | |
| - name: Update devcontainer references | |
| run: | | |
| sed -i -E "s|(mcr\.microsoft\.com/devcontainers/go:)[^"'"'"]+|\1${{needs.dependabot-metadata.outputs.new-version}}|" .devcontainer/devcontainer.json | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add .devcontainer/devcontainer.json | |
| git diff --cached --quiet && exit 0 | |
| git commit --signoff -m "build(deps): bump devcontainer version to ${{needs.dependabot-metadata.outputs.new-version}} | |
| Bumps .devcontainer/devcontainer.json to ${{needs.dependabot-metadata.outputs.new-version}}." | |
| git push origin "HEAD:refs/heads/${{github.event.pull_request.head.ref}}" |