-
Notifications
You must be signed in to change notification settings - Fork 37
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
Just use VM, not docker #10
Comments
I suppose docker use here helps for cross platform compatibilty ( But yeah, I noticed too the |
@lf-novelt IMHO, directly running By the way, yes, I also think JS, instead of docker, more fits into this kind of simple tasks, which also provides cross platform compatibility. The only drawback to find/create JS actions currently is there are many more useful scripts already written in shell script in CI world. But it worths to be considered for us to find/create JS actions. |
For info, I ended up doing exactly what you said:
$postParams = "{'channel': '$Env:CHANNEL', 'attachments': [{'color': '$Env:COLOR', 'pretext': '$Env:PRETEXT', 'text': '$Env:TEXT'}]}"
Invoke-WebRequest -Method POST -Headers @{'Content-Type' = "application/json; charset=utf-8"; 'Authorization' = "Bearer $Env:SLACK_BOT_TOKEN"} -Uri https://slack.com/api/chat.postMessage -Body $postParams callable with this syntax - name: Slack notification test
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
CHANNEL: test-notif
COLOR: good
PRETEXT: Test notif windows from github
TEXT: "<${{ github.event.commits[0].url }} |${{ github.repository }}: *${{ github.event.commits[0].message }} *> by ${{ github.event.commits[0].author.name }}\\n<${{ github.event.commits[0].url }}/checks|Workflow ${{ github.workflow }}>: `${{ job.status }}`"
run: powershell -File ${env:GITHUB_WORKSPACE}\.github\workflows\slack-send.ps1
shell: powershell |
@lf-novelt Great! Thank you for sharing the Powershell script and Action snippet. This would be helpful to others as well :) |
I just added a PR that uses the official curl docker image which cut the build time for me to about 12 seconds #17 |
@robpc Good to hear the improvement. Like by this configuration in runs:
using: 'docker'
image: 'docker://pullreminders/slack-action' Refer to container-action getting started docs or reference in case you're not familar with this yet. |
That's definitely a good suggestion, but I would not be able to make that change without creating my own action (or at least taking ownership of the docker repo). |
@robpc Yes, I know. |
This line would spend time a lot.
https://github.com/pullreminders/slack-action/blob/da2ae3e1a32c9e629f5f6fa59a95f846366e85ff/Dockerfile#L13
I tested this action in my repository, and just building an docker image consumed 40s.
Generally speaking, pulling pre-built image from docker hub is a better option compared to buliding it every time the action is called.
However, I suggest not to use docker just for using curl. According to https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions#ubuntu-1804-lts, VMs already have curl preinstalled. So directly executing
entrypoint.sh
would be the best.The text was updated successfully, but these errors were encountered: