skills / write-javascript-actions

Write your own GitHub JavaScript Action and automate customized tasks unique to your workflow.
MIT License
118 stars 64 forks source link

[Bug] Syntax errors with workflow conditional expressions, needing to reset step to 0 #7

Closed andyfeller closed 2 years ago

andyfeller commented 2 years ago

Describe the bug

  1. Workflow step state is non-0

    It appears that previous development on the template did not revert https://github.com/skills/writing-javascript-actions/blob/main/.github/script/STEP back to 0

  2. Workflow conditional expressions improperly terminated

    The conditional expressions used to selectively trigger workflows in this skills course appear to have syntax errors. The following list of workflows use multi-line conditionals that are terminated improperly:

    • writing-javascript-actions/.github/workflows/4-create-javascript-files-for-action.yml

      -41-    if: ${{ github.repository_owner != 'TBD-organization' }} 
      :42:      && needs.get_current_step.outputs.current_step == 4 }}
    • writing-javascript-actions/.github/workflows/5-add-action-to-workflow-file.yml

      -44-    if: ${{ github.repository_owner != 'TBD-organization' }} 
      :45:      && needs.get_current_step.outputs.current_step == 5 }}
    • writing-javascript-actions/.github/workflows/2-configure-your-action.yml

      -42-    if: ${{ github.repository_owner != 'TBD-organization' }} 
      :43:      && needs.get_current_step.outputs.current_step == 2 }}
    • writing-javascript-actions/.github/workflows/1-initialize-javascript-project.yml

      -43-    if: ${{ github.repository_owner != 'TBD-organization' }} 
      :44:      && needs.get_current_step.outputs.current_step == 1 }}
    • writing-javascript-actions/.github/workflows/3-create-metadata-file.yml

      -44-    if: ${{ github.repository_owner != 'TBD-organization' }} 
      :45:      && needs.get_current_step.outputs.current_step == 3 }}
    • writing-javascript-actions/.github/workflows/6-trigger-action.yml

      -44-    if: ${{ github.repository_owner != 'TBD-organization' }} 
      :45:      && needs.get_current_step.outputs.current_step == 6 }}
  3. Invalid YAML for multi-line conditional

    Using all of the examples above, this is invalid syntax for block YAML use cases.

    Instead of:

         if: ${{ github.repository_owner != 'TBD-organization'
           && needs.get_current_step.outputs.current_step == 6 }}

    One of the following forms must be used:

    1. Single line

          if: ${{ github.repository_owner != 'TBD-organization' && needs.get_current_step.outputs.current_step == 6 }}
    2. Multi line block

          if: |
            ${{ github.repository_owner != 'TBD-organization'
                && needs.get_current_step.outputs.current_step == 6 }}

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior Use of this skills course respected the state of the workflow step under execution without errors.

Screenshots If applicable, add screenshots to help explain your problem.

Device information

Additional context Add any other context about the problem here.

andyfeller commented 2 years ago

cc: @emilyistoofunky

sinsukehlab commented 2 years ago

This time, I have tried multi-line conditional expressions with >-. Cf. #8