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

Do not fail on every non-slash command #124

Open
MOZGIII opened this issue Feb 13, 2020 · 4 comments
Open

Do not fail on every non-slash command #124

MOZGIII opened this issue Feb 13, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@MOZGIII
Copy link
Contributor

MOZGIII commented Feb 13, 2020

Currently, the task fails for every non-slash command, making the regular discussions on the PR impossible due to email spam from Github Actions.
Can we figure out a workaround for it?

@xt0rted
Copy link
Owner

xt0rted commented Feb 14, 2020

Hi @MOZGIII thanks for bringing this up.

It's missing from the sample in the readme, but there's a setting you can add to job steps called continue-on-error that will prevent the workflow from failing.

You can use this along with an if condition on the remaining steps so they only run when the command is provided. It would look something like this:

jobs:
  check_comments:
    name: Check comments for /lint
      steps:
        - uses: xt0rted/slash-command-action@v1
          id: command
          continue-on-error: true
          with:
            repo-token: ${{ secrets.GITHUB_TOKEN }}
            command: lint

        - run: echo "Runs on all /lint commands"
          if: steps.command.outputs.command-name

        - run: echo "Runs only on /lint js command"
          if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'js'

        - run: echo "Runs only on /lint css command"
          if: steps.command.outputs.command-name && steps.command.outputs.command-arguments == 'css'

        - run: echo "This step always runs"

Making the change you proposed in #123 will remove the need for continue-on-error. I'm also working on an update that adds a new out parameter called has-command that can be used for these types of checks.

@xt0rted xt0rted added the enhancement New feature or request label Feb 14, 2020
@MOZGIII
Copy link
Contributor Author

MOZGIII commented Feb 14, 2020

This #123 is unrelated, and it just fixes a bug.

@MOZGIII
Copy link
Contributor Author

MOZGIII commented Feb 14, 2020

continue-on-error would work for me, thx.
I've already switched to a more straightforward solution: a step-level if statement.
https://github.com/timberio/vector-test-harness-github-actions-test-repo/blob/df67ea9b6f2228a4a1947650e990a4b9a71da163/.github/workflows/test-harness.yml#L12-L16

@StephenCleary
Copy link

Can you add this to the README? I believe most users will want this.

wainersm added a commit to wainersm/kata-containers that referenced this issue Jun 17, 2021
There is a problem with slash-command-action which is on absence of a slash command
the job fails (instead of simply ignore, i.e., skip). This is documented on
xt0rted/slash-command-action#124. There is a workaround
also documented on that issue, but here instead let's get rid of the action.

In this new implementation all comments sent to the pull request are parsed, if any
starts with "/test_kata-deploy" then the job is triggered.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
wainersm added a commit to wainersm/kata-containers that referenced this issue Oct 26, 2021
There is a problem with slash-command-action which is on absence of a slash command
the job fails (instead of simply ignore, i.e., skip). This is documented on
xt0rted/slash-command-action#124. There is a workaround
also documented on that issue, but here instead let's get rid of the action.

In this new implementation all comments sent to the pull request are parsed, if any
starts with "/test_kata-deploy" then the job is triggered.

Fixes kata-containers#2836
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants