Skip to content

update-tool-versions #45

update-tool-versions

update-tool-versions #45

name: update-tool-versions
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
update-tool-versions:
runs-on: ubuntu-22.04
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- name: Check out repository
uses: actions/checkout@v4
- name: Set up sd
uses: kenji-miyake/setup-sd@v2
- name: Get clang-format version
id: get-clang-format-version
run: |
function get-latest-pip-version() {
pip index versions "$1" 2>/dev/null | head -n1 | sd '.*\((.*)\)' '$1'
}
echo "version=$(get-latest-pip-version clang-format)" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update clang-format version
run: |
sd '(pre_commit_clang_format_version): .*' '$1: ${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/defaults/main.yaml
sd '(pre_commit_clang_format_version)=.*' '$1=${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/README.md
- name: Create PR
id: create-pr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate-token.outputs.token }}
base: ${{ github.event.repository.default_branch }}
branch: update-tool-versions
title: "chore: update tool versions"
commit-message: "chore: update tool versions"
body: ""
labels: |
tag:bot
tag:update-tool-versions
signoff: true
delete-branch: true
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}"
shell: bash
- name: Enable auto-merge
if: ${{ steps.create-pr.outputs.pull-request-operation == 'created' }}
run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}