41

Introduction

I am currently to crate a composite GitHub Actions that build a JavaDoc from Java project and publish it automatically to a static page with GitHub Page.

Problematic

But I got this error when I try to run it:

Current runner version: '2.287.1'
Operating System
Virtual Environment
Virtual Environment Provisioner
GITHUB_TOKEN Permissions
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'MathieuSoysal/[email protected]' (SHA:878c07f835dd9bcbb8800090d109c91b0f0d4581)
Error: MathieuSoysal/Javadoc-publisher.yml/v2.0.2/action.yml (Line: 29, Col: 5): Required property is missing: shell
Error: MathieuSoysal/Javadoc-publisher.yml/v2.0.2/action.yml (Line: 29, Col: 5): Required property is missing: shell
Error: GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid. MathieuSoysal/Javadoc-publisher.yml/v2.0.2/action.yml (Line: 29, Col: 5): Required property is missing: shell
   at GitHub.DistributedTask.ObjectTemplating.TemplateValidationErrors.Check()
   at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext, TemplateContext templateContext, TemplateToken inputsToken, String fileRelativePath, MappingToken outputs)
   at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile)
Error: Fail to load MathieuSoysal/Javadoc-publisher.yml/v2.0.2/action.yml

Affected code:

name: Deploy Javadoc
description: 'Automatically  generate your Javadoc from your maven project and deploy it with GitHub Page on javadoc branch.'
branding:
  icon: 'book-open'
  color: 'white'
inputs:
  java-version:  # version of java
    description: 'Java version inside your project'
    required: true
    default: '17'
  GITHUB_TOKEN: # GitHub Token
    description: 'The GitHub token the GitHub repository'
    required: true
  javadoc-branch: # branch where the javadoc is hosted
    description: 'Branch where the javadoc is hosted'
    required: true
    default: javadoc
 
runs:
  using: "composite"
  steps:
  - uses: actions/checkout@v2
    with:
      fetch-depth: 0
  - uses: actions/setup-java@v2
    with:
      java-version: ${{ inputs.java-version }}
      distribution: 'adopt'
  - name: Generate Javadoc
    run: mvn org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:aggregate
  - name: Deploy 🚀
    uses: JamesIves/[email protected]
    with:
      GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
      BRANCH: ${{ inputs.javadoc-branch }}
      CLEAN: true
      FOLDER: target/site/apidocs
      TARGET_FOLDER: javadoc

Code that execute the GitHub Actions in question:

name: Deploy Javadoc

on:
  push:
    branches:
      - master

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-version: 17

Question

Anyone have an idea to solve this problem?

3 Answers 3

73
+50
Answer recommended by CI/CD Collective

When using composite actions, you have to specify the shell.

As you don’t specify a runner type in composite actions, you need to specify the shell instead for each action.

In your case, the problem is in this step, you need to add shell: bash here:

- name: Generate Javadoc
  shell: bash
  run: mvn org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:aggregate

Docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action#creating-an-action-metadata-file

6
  • 3
    are there any resources for why this is the case?
    – chantey
    Commented Jul 30, 2022 at 10:26
  • 2
    @chantey docs.github.com/en/actions/creating-actions/… Commented Jul 31, 2022 at 17:39
  • 4
    @GrzegorzKrukowski the link doesn't go into the why. Unfortunately I find Github Actions documentation to be lacking, in general Commented Dec 9, 2022 at 12:29
  • 1
    @GustavoPuma you are right I will update "WHY" in my answer, they don't have it in docs Commented Dec 9, 2022 at 12:33
  • 2
    thank you. I understand that a workflow always needs to define a runner type. Would you happen to know why it is not the case that the composite action cannot simply use whatever was specified in the caller? Commented Dec 9, 2022 at 12:43
4

Putting this here to help other noobs like me and because it's too long for a comment on the actual answer.

If you loosely followed https://docs.github.com/en/actions/creating-actions/creating-a-composite-action (where it doesn't explicitly tell you that the shell property is required) to create your action, it told you to tag the commit with v1 and then in the workflow that you are trying to use the action you specify @v1

Now if, like me, you omitted the shell property in the action you are creating, you'll be getting 'Required property is missing: shell' And if, like me, you've been adding 'shell: bash' all over the action.yaml for hours wondering why it's still broken, it's because you're still specifying @v1 in the workflow file which of course is referencing a commit/version before the many commits you've made trying to fix the action.

So, make sure to specify @master/main/ in your workflow file..

0

I came to this question but my error was No event triggers defined in "on".

My intention was to have a small action that runs node setup + npm install with caching on my own repo.

Composite Actions should NOT be in the .github/workflows/ folder, otherwise they treat it as a workflow. Kinda obvious but not totally intuitive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.