Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure GitHub action #516

Open
pburgisser opened this issue Sep 21, 2023 · 1 comment
Open

Configure GitHub action #516

pburgisser opened this issue Sep 21, 2023 · 1 comment

Comments

@pburgisser
Copy link

pburgisser commented Sep 21, 2023

Hi,

I'm trying to use commitsar as a GH Action with my own config file but I don't know how to set the config in the action
I tried the following combinations:

env:
  COMMITSAR_CONFIG_PATH: ".github/linters/commitsar.yaml"
# or
with:
  COMMITSAR_CONFIG_PATH: ".github/linters/commitsar.yaml"
# or
with:
  config: '.github/linters/commitsar.yaml'
# or
env:
   config: '.github/linters/commitsar.yaml'

But at run, commitsar says there is no config file set:

Run aevea/commitsar@v0.20.2
  with:
    config: .github/linters/commitsar.yaml
  env:
    config: .github/linters/commitsar.yaml
/usr/bin/docker run --name bba96d741a5cf4cf59[3](https://github.com/xxxxxx/actions/runs/6265205933/job/17013518497#step:4:3)f5c[4](https://github.com/xxxxx/actions/runs/6265205933/job/17013518497#step:4:4)40e1a94fc[5](https://github.com/xxxxx/actions/runs/6265205933/job/17013518497#step:4:5)_09f511 --label 94351b --workdir /github/workspace --rm -e "config" -e "INPUT_CONFIG" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/xxxxxx":"/github/workspace" xxxxx:ba9[6](https://github.com/xxxxx/actions/runs/xxxxxx/job/xxxxxx#step:4:7)d741a5cf4cf593f5c440e1a94fc5

2023/09/21 17:44:25 config file not found, using defaults
   • Starting pipeline: commit-pipeline
   • Starting analysis of commits on branch HEAD

eg: of my action:

name: Linters

on: [pull_request]

jobs:
  validate-commits:
    runs-on: ubuntu-latest
    steps:
      - name: Check out code into the Go module directory
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Commitsar check
        #uses: docker://aevea/commitsar
        uses: aevea/commitsar@v0.20.2
        with:
          config: '.github/linters/commitsar.yaml'
        env:
          config: '.github/linters/commitsar.yaml'

eg of my config:

commits:
  limit: 1

Thanks a lot

@jeanplevesque
Copy link

jeanplevesque commented Jan 9, 2024

I managed to make it work using environment variables like this:

(...)
- name: Commitsar check
  uses: docker://aevea/commitsar
  env:
    COMMITSAR_CONFIG_PATH : ./.github

My repository is structured like this:
image

  • .github/workflows/conventional-commits.yml contains the github action with the code from above.
  • .github/.commitsar.yml is the configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants