diff --git a/.github/workflows/test.yaml b/.github/workflows/test-pr.yaml similarity index 69% rename from .github/workflows/test.yaml rename to .github/workflows/test-pr.yaml index c7e43b0..133cb91 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test-pr.yaml @@ -1,12 +1,14 @@ name: Code Formatter on: - push: + pull_request: jobs: clang-format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: ./ + with: + branch: ${{ github.event.pull_request.head.ref }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/action.yml b/action.yml index 1b6ce58..f2ca39c 100644 --- a/action.yml +++ b/action.yml @@ -18,6 +18,10 @@ inputs: description: 'The commit message used when changes need to be committed' required: false default: 'style: Applied ROS C++ Style Guide' + branch: + description: 'The branch the changes will be committed.' + required: false + default: 'None' runs: using: 'docker' image: 'Dockerfile' @@ -25,3 +29,4 @@ runs: - ${{ inputs.author-name }} - ${{ inputs.author-email }} - ${{ inputs.commit-message }} + - ${{ inputs.branch }} diff --git a/entrypoint.sh b/entrypoint.sh index b363d5f..8875545 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,6 +4,7 @@ name=$1 email=$2 message=$3 +branch=$4 apt-get update apt-get install -y curl @@ -47,9 +48,14 @@ if [[ $? == 0 ]] ;then git config --global user.email "$email" git config --global user.name "$name" - git config --global push.default current + if [[ $branch == "None" ]];then + branch=$(git rev-parse --abbrev-ref HEAD) + fi git commit -a -m "$message" - git push + + echo "Pushing to $GITHUB_REF" + + git push origin HEAD:"$GITHUB_REF" else echo "No changes to commit" fi diff --git a/test/dji_sdk_node.cpp b/test/dji_sdk_node.cpp index 51fcd60..450f14b 100644 --- a/test/dji_sdk_node.cpp +++ b/test/dji_sdk_node.cpp @@ -17,8 +17,7 @@ DJISDKNode::DJISDKNode(ros::NodeHandle& nh, ros::NodeHandle& nh_private) : telemetry_from_fc(USE_BROADCAST) , R_FLU2FRD(tf::Matrix3x3(1, 0, 0, 0, -1, 0, 0, 0, -1)) , R_ENU2NED(tf::Matrix3x3(0, 1, 0, 1, 0, 0, 0, 0, -1)) - , curr_align_state(UNALIGNED) -{ + , curr_align_state(UNALIGNED){ nh_private.param("serial_name", serial_device, std::string("/dev/ttyUSB0")); nh_private.param("baud_rate", baud_rate, 921600); nh_private.param("app_id", app_id, 123456); @@ -41,7 +40,7 @@ DJISDKNode::DJISDKNode(ros::NodeHandle& nh, ros::NodeHandle& nh_private) // @todo need some error handling for init functions //! @note parsing launch file to get environment parameters if (!initVehicle(nh_private)) - { +{ ROS_ERROR("Vehicle initialization failed"); }