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

Consider moving pre logic to the main entrypoint #66

Closed
zharinov opened this issue Aug 6, 2022 · 0 comments · Fixed by #68
Closed

Consider moving pre logic to the main entrypoint #66

zharinov opened this issue Aug 6, 2022 · 0 comments · Fixed by #68

Comments

@zharinov
Copy link
Contributor

zharinov commented Aug 6, 2022

It seems like pre-action feature breaks GitHub actions composability.
GitHub doesn't support YAML anchors feature that would decrease code duplication.

However, GitHub provides composite actions which are defined the similar way action.yml in this repo does, but instead of JavaScript code it depends on and runs another actions. You can think of it like higher-order action.

The problematic scenario is following:

  1. Define composite action in .github/actions/setup-clojure
name: 'Setup Clojure tooling'
description: 'Install Java, Clojure CLI and Babashka'
runs:
  using: "composite"
  steps:
    - uses: actions/setup-java@v3.4.1
      with:
        distribution: temurin
        java-version: 11

    - uses: DeLaGuardo/setup-clojure@9.3
      with:
        cli: latest
        lein: latest
        bb: latest

    - name: Package cache
      uses: actions/cache@v3.0.6
      with:
        path: |
          ~/.m2/repository
          ~/.gitlibs
          ~/.deps.clj
        key: cljdeps-${{ hashFiles('project.clj', 'deps.edn', 'bb.edn') }}
        restore-keys: cljdeps-
  1. Use it from the workflow file .github/workflows/test in the same repository
- steps:
  # Essential if you're using locally-defined action
  - name: Checkout
    uses: actions/checkout@v3.0.2
  
  - name: Setup Clojure tooling
    uses: ./github/actions/setup-clojure
  1. DeLaGuardo/setup-clojure@9.3 outputs warning and skips main entrypoint:
Warning: `pre` execution is not supported for local action from './.github/actions/setup-clojure'
  1. The entire workflow later fails with something like:
clojure: command not found
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

Successfully merging a pull request may close this issue.

1 participant