Merge branch 'wesnoth:master' into master #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: IRC Notification | |
on: | |
push: | |
pull_request_target: | |
types: [ opened, closed, reopened ] | |
issues: | |
types: [ opened, closed, reopened ] | |
# create: # creation also gets mentioned when pushing | |
delete: | |
jobs: | |
notify: | |
if: vars.IRC_CHANNEL != '' # skip if not set up (like in a fork for example) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare message | |
if: github.event_name == 'push' | |
env: | |
MSG: ${{ github.event.head_commit.message }} | |
run: | | |
printf COMMIT_SUBJECT=%s "${MSG}" | head -n 1 >> "$GITHUB_ENV" | |
- uses: rectalogic/notify-irc@v1 | |
env: { COLOR: "\x03", BLUE: "02", PURPLE: "06", ACTOR: "\x0315${{ github.actor }}\x03" } | |
with: | |
channel: ${{ vars.IRC_CHANNEL }} | |
server: ${{ vars.IRC_SERVER }} | |
nickname: ${{ vars.IRC_NICK }} # is also used for sasl username | |
sasl_password: ${{ secrets.IRC_SASL_PASSWORD }} | |
# See https://docs.github.com/en/actions/learn-github-actions/expressions | |
# github context: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context | |
# github.event data: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads | |
message: >- | |
${{ (github.event_name == 'push' && | |
format('{1} {2} {0}{3}{4}{0}: {5}: {0}{6}{7}{0}', env.COLOR, env.ACTOR, | |
(github.event.created && (github.event.tag && 'tagged' || 'created')) || (github.event.deleted && 'deleted') || (github.event.forced && 'force-pushed to') || 'pushed to', | |
env.PURPLE, github.ref_name, env.COMMIT_SUBJECT, env.BLUE, github.event.compare) | |
) || (github.event_name == 'pull_request_target' && | |
format('{1} {2} PR #{3} for {0}{4}{5}{0}: {6}: {0}{7}{8}{0}', env.COLOR, env.ACTOR, github.event.action, github.event.number, env.PURPLE, github.base_ref, github.event.pull_request.title, env.BLUE, github.event.pull_request.html_url) | |
) || (github.event_name == 'issues' && | |
format('{1} {2} issue {0}{3}#{4}{0}: {5}: {0}{6}{7}{0}', env.COLOR, env.ACTOR, github.event.action, env.PURPLE, github.event.issue.number, github.event.issue.title, env.BLUE, github.event.issue.html_url) | |
) || ((github.event_name == 'create' || github.event_name == 'delete') && | |
format('{1} {2}d {3} {0}{4}{5}{0}', env.COLOR, env.ACTOR, github.event_name, github.event.ref_type, env.PURPLE, github.event.ref) | |
) | |
}} | |
_debug: ${{ toJSON(github) }} |