Skip to content

Commit

Permalink
Refactor action to be composite instead of docker based
Browse files Browse the repository at this point in the history
  • Loading branch information
renefritze authored and platisd committed Jan 15, 2024
1 parent 18e75ce commit dc994a2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
version: 2

updates:
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

28 changes: 26 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,33 @@ inputs:
required: false
default: '/home/runner/work'


runs:
using: 'docker'
image: 'Dockerfile'
using: 'composite'
steps:
- name: Setup Python
uses: actions/setup-python@v5
id: setup-python
with:
python-version: "3.11"
update-environment: false
- name: Setup venv
run: ${{ steps.setup-python.outputs.python-path }} -m venv ${GITHUB_ACTION_PATH}/venv

shell: bash -l {0}
- name: Install dependencies
run: ${GITHUB_ACTION_PATH}/venv/bin/python -m pip install -r ${GITHUB_ACTION_PATH}/requirements.txt
shell: bash -l {0}
- name: Run action
run: ${GITHUB_ACTION_PATH}/action_launcher.bash
shell: bash -l {0}
env:
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_CLANG_TIDY_FIXES: ${{ inputs.clang_tidy_fixes }}
INPUT_PULL_REQUEST_ID: ${{ inputs.pull_request_id }}
INPUT_REQUEST_CHANGES: ${{ inputs.request_changes }}
INPUT_SUGGESTIONS_PER_COMMENT: ${{ inputs.suggestions_per_comment }}
INPUT_REPO_PATH_PREFIX: ${{ inputs.repo_path_prefix }}
branding:
icon: 'cpu'
color: 'green'
4 changes: 2 additions & 2 deletions entrypoint.sh → action_launcher.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

if [ -z "$INPUT_PULL_REQUEST_ID" ]; then
if [ -z "${INPUT_PULL_REQUEST_ID:-}" ]; then
pull_request_id="$(jq "if (.issue.number != null) then .issue.number else .number end" < "$GITHUB_EVENT_PATH")"

if [ "$pull_request_id" == "null" ]; then
Expand All @@ -27,7 +27,7 @@ if [ ! -f "$INPUT_CLANG_TIDY_FIXES" ]; then
exit 0
fi

/action/run_action.py \
"${GITHUB_ACTION_PATH}/venv/bin/python" "${GITHUB_ACTION_PATH}/run_action.py" \
--clang-tidy-fixes "$INPUT_CLANG_TIDY_FIXES" \
--pull-request-id "$pull_request_id" \
--repository "$GITHUB_REPOSITORY" \
Expand Down

0 comments on commit dc994a2

Please sign in to comment.