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

Compact format like travis #70

Closed
8398a7 opened this issue Jun 12, 2020 · 18 comments · Fixed by #83
Closed

Compact format like travis #70

8398a7 opened this issue Jun 12, 2020 · 18 comments · Fixed by #83
Labels
help wanted Extra attention is needed

Comments

@8398a7
Copy link
Owner

8398a7 commented Jun 12, 2020

Ok, sad, but if you could add the time the job took and the compact (travis like) formatting I would be very happy.

@8398a7 8398a7 changed the title Add a field for free text Compact format like travis Jun 12, 2020
@8398a7
Copy link
Owner Author

8398a7 commented Jun 12, 2020

@FonsRademakers

I misunderstood the intent of your comment.
If you want a compact format, such as travis, you can leave the fields unspecified so that only the text you choose to display is shown.

Wouldn't it be more compact if you wrote the following?

steps:
  - uses: 8398a7/action-slack@v3
    with:
      status: ${{ job.status }}
      fields: ''
    env:
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required

The job took is not on the agenda here, as we want to discuss it in issue #38.

@FonsRademakers
Copy link

FonsRademakers commented Jun 12, 2020 via email

@8398a7
Copy link
Owner Author

8398a7 commented Jun 13, 2020

Do you think the problem is that the current format makes it too vertical?
Unfortunately, when you commented earlier, the image wasn't showing up on the GitHub Issue.
comment

Do you assume you want to display the following format?


Succeeded GitHub Actions
repo: 8398a7/action-slack, message: bump 3.1.0, commit: 631738b, author: 839<8398a7@gmail.com>, eventName: push, ref: refs/head/master, workflow: Slack Mainline, job: check_pr

@FonsRademakers
Copy link

Screen Shot 2020-06-13 at 17 11 06
Hi, hope now the example is clear. Try to be as compact as the Travis CI log message. You could add one last line being the checkin message. You current format is way to vertical. And as in the Travis example only two links are needed (one to the specific action output and one to the specific git hash for the checkin.

@FonsRademakers
Copy link

Example:
"
Succeeded macOS CI (63edc15) of BioDynaMo/biodynamo@github-actions by Fons Rademakers in 7 min 22 sec
More centos debugging.
"

Where macOS CI is a link to the specific action and where 63edc15 is a link to the pushed code. Having more links or links pointing the same is just confusing.

Thanks, Fons.

@8398a7
Copy link
Owner Author

8398a7 commented Jun 13, 2020

Thank you. Do you use v2 for this?
Explicitly specify the fields (e.g. author, action) to be displayed from v3 is possible.
It is our policy not to support individual user formats, as there is an infinite number of patterns.
It would be better if you can use v3 to focus on the fields you need.

@FonsRademakers
Copy link

I use v3:

- name: Notify Slack
  uses: 8398a7/action-slack@v3
  with:
    status: ${{ job.status }}
    author_name: Integration Test
    fields: repo,ref,message,author,action,workflow # default: repo,commit
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
  if: always() # Pick up events even if the job fails or is canceled.

which gives this way to vertical format. Could you not just make one option for a compact format, like:

with:
fields: compact

or something like that. There are infinite number of patterns, but now there is not a single good one. ;-)

@8398a7
Copy link
Owner Author

8398a7 commented Jun 13, 2020

If a library provides fields: compact, it is up to the person to decide what information they want. Doesn't it vary by?

I think it's possible to display them as a comma-separated list instead of using slack attachments.
The message would be as follows.

ss

The values are assumed to be as follows.
Add a style key.

- name: Notify Slack
  uses: 8398a7/action-slack@v3
  with:
    status: ${{ job.status }}
    author_name: Integration Test
    fields: repo,ref,message,author,action,workflow # default: repo,commit
    style: compact
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
  if: always() # Pick up events even if the job fails or is canceled.

By the way, if you restrict the fields like fields: repo,message, you can use the I think it will be much more compact.

ss2

@FonsRademakers
Copy link

I like 'style: compact', but as compact message I would propose:

"Workflow"
"action" ("hash") of "repo"@"branch" by "user" "failed|succeeded|canceled" in "xx" min "yy" sec
"log message"

macOS CI
build (63edc15) of BioDynaMo/biodynamo@bugfix-1 by Fons Rademakers succeeded in 4 min 23 sec
Fix last bug concerning GPU acceleration.

where "workflow", "action", "hash" are links. The log message has an entire line, as message are typically more than 20 chars.

This message is very clear and does not need any redundant keywords to be understandable, like 'repo', 'commit', 'author', 'eventName', 'ref', 'workflow' and 'job'. Everything is clear and concise.

I an my users would be grateful as we get many action Slack message per day.

Cheers, Fons.

@8398a7
Copy link
Owner Author

8398a7 commented Jun 15, 2020

The template itself is great.
But as a library author, I don't want to have to think about the appropriate wording for each additional field.
I'm thinking of taking a break from this and allowing you to specify your preferred template.

steps:
  - uses: 8398a7/action-slack@v3
    with:
      status: custom
      custom_payload: |
        {
          text: "${this.workflow()}\n${this.job()} (${this.commit()}) of ${this.repo()}@${this.branch()} by ${this.author()} ${job.status()} in ${took()}\n${message()}",
        }
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # optional
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required

This is a big change and it may take some time.
However, I think this feature satisfies two requests: "I don't want to maintain the wording" and "I want to send the formatting I want".

@FonsRademakers
Copy link

I'm perfectly fine with this. Is this available right now in v3?

  • Fons

@8398a7
Copy link
Owner Author

8398a7 commented Jun 15, 2020

No, it's not available. There are no destructive changes, though, so I think the release will be v3.

@FonsRademakers
Copy link

Fantastic. Looking forward to testing it.

@8398a7 8398a7 added the help wanted Extra attention is needed label Jun 20, 2020
8398a7 added a commit that referenced this issue Jun 28, 2020
8398a7 added a commit that referenced this issue Jun 28, 2020
8398a7 added a commit that referenced this issue Jun 28, 2020
@8398a7 8398a7 mentioned this issue Jun 28, 2020
@8398a7
Copy link
Owner Author

8398a7 commented Jun 28, 2020

It doesn't support branch information that action-slack doesn't have, but we've provided it as a basic feature.
refs: https://action-slack.netlify.app/usecase/02-custom

If you need branch information, I'm always open to contributions!
You can use ref as branch information.

custom

Thanks for the suggestions and discussion.

@FonsRademakers
Copy link

FonsRademakers commented Jun 29, 2020 via email

@FonsRademakers
Copy link

FonsRademakers commented Jun 29, 2020 via email

@8398a7
Copy link
Owner Author

8398a7 commented Jun 29, 2020

I haven't investigated the behavior when using matrix, so there may be a possibility of mixing it up.
Also, no screenshots seem to be attached... 😢

@FonsRademakers
Copy link

FonsRademakers commented Jun 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants