generate_rosdep_yaml #1470
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
name: generate_rosdep_yaml | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
generate_rosdep_yaml: | |
name: generate_rosdep_yaml | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: basic install | |
run: | | |
sudo apt install make ansible | |
- name: ansible version | |
run: | | |
ansible-playbook --version | |
- uses: actions/checkout@v4 | |
- name: run ansible | |
run: | | |
ansible-playbook -i ansible/hosts/localhost.ini ansible/export_repos.yml --connection local --become -e ansible_user=ubuntu | |
- name: run script | |
run: | | |
python3 generate_rosdep_yaml.py ../robotx_ws/src/ | |
working-directory: scripts | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rosdep_yaml | |
path: scripts/rosdep.yaml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: repos_file | |
path: | | |
ansible/packages.repos | |
ansible/packages_exact.repos | |
deploy_to_ouxt_distro: | |
name: deploy_to_ouxt_distro | |
runs-on: ubuntu-22.04 | |
needs: generate_rosdep_yaml | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: OUXT-Polaris/ouxt_distro | |
token: ${{ secrets.WAMV_TAN_BOT_SECRET }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: rosdep_yaml | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repos_file | |
- name: Check branch exist | |
id: check_branch | |
run: | | |
echo "name=exist::$(git ls-remote --heads https://github.com/OUXT-Polaris/ouxt_distro.git deploy | wc -l)" >> "$GITHUB_OUTPUT" | |
- name: Count changes | |
id: changes | |
run: | | |
git add -N . | |
echo "name=count::$(git diff --name-only | wc -l)" >> "$GITHUB_OUTPUT" | |
- name: Check default branch | |
id: check_default_branch | |
run: | | |
echo "name=default_branch::$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" >> "$GITHUB_OUTPUT" | |
- uses: peter-evans/create-pull-request@v3 | |
id: create_pull_request | |
if: steps.check_branch.outputs.exist == 0 && steps.changes.outputs.count > 0 | |
with: | |
token: ${{ secrets.WAMV_TAN_BOT_SECRET }} | |
commit-message: Update rosdep.yaml | |
committer: wam-v-tan <[email protected]> | |
author: wam-v-tan <[email protected]> | |
signoff: false | |
branch: deploy | |
base: ${{ steps.check_default_branch.outputs.default_branch }} | |
delete-branch: true | |
title: '[Bot] Update workflow' | |
body: | | |
# Description | |
Update rosdep.yaml | |
# How to check | |
Please check passing all CI test. | |
labels: | | |
bot | |
assignees: wam-v-tan | |
reviewers: wam-v-tan | |
team-reviewers: | | |
owners | |
maintainers | |
draft: false | |
- name: Enable Pull Request Automerge | |
if: steps.create_pull_request.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v1 | |
with: | |
token: ${{ secrets.WAMV_TAN_BOT_SECRET }} | |
pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} | |
merge-method: squash | |
repository: OUXT-Polaris/ouxt_distro |