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

Explain what this does better than the native syntax? #5

Open
jorhett opened this issue Oct 14, 2022 · 4 comments
Open

Explain what this does better than the native syntax? #5

jorhett opened this issue Oct 14, 2022 · 4 comments

Comments

@jorhett
Copy link

jorhett commented Oct 14, 2022

It's hard to grasp why this action exists, as this feature set is built into Actions today. If this provides a value not provided by GitHub Actions syntax you should add it to the documentation.

The documentation's example runs exactly the same, and much faster, written as the following:

jobs:
  something:
    name: Do something...
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
    
      - id: post-run-command
        needs: non-existent-command
        if: ${{ always() }}
        run: echo "this thing works!"

      - id: another-post-run-command
        needs: non-existent-command
        if: ${{ always() }}
        run: echo "this thing works again!"
        working-directory: not-required-but-you-can-provide-it

      - id: non-existent-command
        name: 'Running an non-existing command will fail...'
        run: run something that does not exist;
@ftzm
Copy link

ftzm commented Oct 27, 2022

Is this valid? I don't believe it's possible to specify "needs" on individual steps. I can find no documentation for it, and it doesn't work when I try it. Maybe I'm missing something.

@Piedone
Copy link

Piedone commented Nov 16, 2022

It doesn't work, You need to execute post-job code in a JavasScript action with runs.post.

@swissbuechi
Copy link

@jorhett
Your solution does not work for me.
I acctually needed the following syntax to make the post step always run (even if some steps above fail):

    - name: Show VPN log
      uses: webiny/[email protected]
      if: always()
      with:
        run: sudo cat vpn.log

Thanks to @adrians5j for publishing this action!

@swissbuechi
Copy link

It's hard to grasp why this action exists, as this feature set is built into Actions today. If this provides a value not provided by GitHub Actions syntax you should add it to the documentation.

The documentation's example runs exactly the same, and much faster, written as the following:

jobs:
  something:
    name: Do something...
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
    
      - id: post-run-command
        needs: non-existent-command
        if: ${{ always() }}
        run: echo "this thing works!"

      - id: another-post-run-command
        needs: non-existent-command
        if: ${{ always() }}
        run: echo "this thing works again!"
        working-directory: not-required-but-you-can-provide-it

      - id: non-existent-command
        name: 'Running an non-existing command will fail...'
        run: run something that does not exist;

I think your solution is working if you create a plain simple github action workflow.
But this action does add the ability to add a post action for a custom github composer action.
Normally you would have to create a github javascript action to achieve this.

Check out my repo where I successfully use this action: https://github.com/swissbuechi/action-openvpn-client

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

4 participants