action-slack
action-slack copied to clipboard
Allow sharing common parameters between steps
Consider a workflow that has three jobs, each with a step that calls action-slack, for example:
- uses: 8398a7/action-slack@v3
with:
status: custom
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
{
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} ${{ job.status }} in ${process.env.AS_TOOK}`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
That would be a lot of copy-paste (and potential drifting) between the jobs. As GitHub Actions does not seem to support YAML anchors, it would be nice if this action had some way of defining common options for a workflow, and then defaulting to them unless overridden.
Thank you for your suggestion. Can you make a pull request?