forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add update-tool-versions.yaml (autowarefoundation#319)
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
- Loading branch information
1 parent
a08e1bf
commit 79d5373
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: update-tool-versions | ||
|
||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-tool-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate token | ||
id: generate-token | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.PRIVATE_KEY }} | ||
|
||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up sd | ||
uses: kenji-miyake/setup-sd@v1 | ||
|
||
- name: Get clang-format version | ||
id: get-clang-format-version | ||
run: | | ||
latest_tag_name=$(gh release view --repo https://github.com/llvm/llvm-project --json tagName --jq ".tagName") | ||
echo ::set-output name=version::$(echo "$latest_tag_name" | sd '.*-(.*)' '$1') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update clang-format version | ||
run: | | ||
sd '(clang_format_version): .*' '$1: ${{ steps.get-clang-format-version.outputs.version }}' ansible/roles/pre_commit/defaults/main.yaml | ||
sd '(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@v4 | ||
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: | | ||
bot | ||
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' }} | ||
uses: peter-evans/enable-pull-request-automerge@v2 | ||
with: | ||
token: ${{ steps.generate-token.outputs.token }} | ||
pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} | ||
merge-method: squash |