Initial overhaul of S_intuit_more #17617
Workflow file for this run
This file contains hidden or 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: "Push Notification" | |
on: | |
issues: | |
types: [opened, reopened, closed] | |
pull_request: | |
types: [opened, reopened, closed] | |
push: | |
# add create for tracking tags | |
# IRC colors: https://modern.ircdocs.horse/formatting.html | |
# yaml formating: https://www.yaml.info/learn/quote.html | |
permissions: {} | |
jobs: | |
notify-irc: | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
# only on main repo | |
if: ( github.event.pull_request.head.repo.full_name == 'Perl/perl5' || github.repository == 'Perl/perl5' ) | |
env: | |
server: ssl.irc.perl.org | |
port: 7062 | |
channel_p5p: "#p5p" | |
channel_noise: "#p5p-commits" | |
color_green: "\x0303" | |
color_orange: "\x0307" | |
color_pink: "\x0313" | |
color_clear: "\x0F" | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: setup branch env name | |
run: | | |
ref="${github_ref/refs\/heads\//}" | |
echo "ref=$ref" >> $GITHUB_ENV | |
env: | |
github_ref: ${{ github.event.ref }} | |
- name: Setup commit message SUMUP env | |
id: sumup | |
env: | |
TXT: ${{ join(github.event.commits.*.message, '\n') }} | |
C1: ${{ github.event.commits[0].message }} | |
C2: ${{ github.event.commits[1].message }} | |
C3: ${{ github.event.commits[2].message }} | |
C4: ${{ github.event.commits[3].message }} | |
C5: ${{ github.event.commits[4].message }} | |
run: | | |
# ------------------------------------- | |
echo "# original commit message" | |
echo "TXT=$TXT" | |
# ------------------------------------- | |
echo "# Last 5 commits message" | |
echo "C1=$C1" | |
echo "C2=$C2" | |
echo "C3=$C3" | |
echo "C4=$C4" | |
echo "C5=$C5" | |
# ------------------------------------- | |
echo "# script parse.pl" | |
cat <<'EOS' > parse.pl | |
use v5.14; use strict; use warnings; | |
my $txt = join "\n", map { $ENV{"C$_"} // '' } 1..5; | |
$txt =~ s{\\n}{\n}g; $txt =~ s{\\t}{ }g; $txt =~ s{\t}{ }g; | |
my @l = split( "\n", $txt ); | |
my $max = 5; | |
@l = ( @l[0..$max], "..." ) if @l > $max; | |
@l = grep { $_ !~ m{^EOS} } @l; | |
say( join( "\n", @l ) ); | |
EOS | |
# ------------------------------------- | |
echo "# testing script" | |
perl parse.pl | |
# ------------------------------------- | |
echo "# setup SUMUP environment variable" | |
echo 'SUMUP<<EOS' >> $GITHUB_ENV | |
perl parse.pl >> $GITHUB_ENV | |
echo 'EOS' >> $GITHUB_ENV | |
# ------------------------------------- | |
echo "# done" | |
- name: checking SUMUP variable | |
run: | | |
echo "SUMUP: $SUMUP" | |
- name: irc push | |
uses: mauke/[email protected] | |
if: github.event_name == 'push' && github.ref != 'refs/heads/blead' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
join: true | |
channel: ${{ env.channel_noise }} | |
nickname: Commit | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} pushed to branch ${{ env.color_green }}${{ env.ref }}${{ env.color_clear }} | |
${{ env.SUMUP }} | |
${{ github.event.compare }} | |
- name: irc push to blead | |
uses: mauke/[email protected] | |
if: github.event_name == 'push' && github.ref == 'refs/heads/blead' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
join: true | |
channel: ${{ env.channel_noise }} | |
nickname: inBlead | |
message: |- | |
${{ env.color_pink }}[blead]${{ env.color_clear }} ${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} pushed to blead | |
${{ env.SUMUP }} | |
${{ github.event.compare }} | |
- name: Shorten issue/PR fields | |
if: github.event_name == 'pull_request' || github.event_name == 'issues' | |
id: shorten | |
env: | |
TITLE: ${{ github.event.pull_request.title || github.event.issue.title }} | |
BODY: ${{ github.event.pull_request.body || github.event.issue.body }} | |
run: | | |
# ------------------------------------- | |
echo "# script parse.pl" | |
cat <<'EOS' > parse.pl | |
use v5.14; use warnings; | |
my ( $key, $len ) = @ARGV; | |
$key //= ''; $len //= 50; | |
my $txt = substr( $ENV{$key} || "Unknown $key", 0, $len ); | |
$txt =~ s{\\n}{\n}g; $txt =~ s{\\t}{ }g; $txt =~ s{\t}{ }g; | |
$txt =~ s{^EOS}{}mg; | |
say $txt; | |
EOS | |
# ------------------------------------- | |
echo 'TITLE<<EOS' >> $GITHUB_ENV | |
perl parse.pl TITLE 80 >> $GITHUB_ENV | |
echo 'EOS' >> $GITHUB_ENV | |
# ------------------------------------- | |
echo 'BODY<<EOS' >> $GITHUB_ENV | |
perl parse.pl BODY 500 >> $GITHUB_ENV | |
echo 'EOS' >> $GITHUB_ENV | |
# ------------------------------------- | |
echo "# done" | |
- name: checking BODY and TITLE variable | |
if: github.event_name == 'pull_request' || github.event_name == 'issues' | |
run: | | |
echo "BODY: $BODY" | |
echo "TITLE: $TITLE" | |
- name: irc opened pull request | |
uses: mauke/[email protected] | |
if: github.event_name == 'pull_request' && github.event.action == 'opened' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: Pull-Request | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} opened PR #${{ github.event.pull_request.number }}: ${{ env.TITLE }} - ${{ github.event.pull_request.html_url }} | |
- name: irc reopened pull request | |
uses: mauke/[email protected] | |
if: github.event_name == 'pull_request' && github.event.action == 'reopened' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: Pull-Request | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} reopened PR #${{ github.event.pull_request.number }}: ${{ env.TITLE }} - ${{ github.event.pull_request.html_url }} | |
- name: irc merged pull request | |
uses: mauke/[email protected] | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: Pull-Request | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} merged PR #${{ github.event.pull_request.number }}: ${{ env.TITLE }} - ${{ github.event.pull_request.html_url }} | |
- name: irc closed pull request | |
uses: mauke/[email protected] | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == false | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: Pull-Request | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} closed PR #${{ github.event.pull_request.number }}: ${{ env.TITLE }} - ${{ github.event.pull_request.html_url }} | |
- name: irc synchronize pull request | |
uses: mauke/[email protected] | |
if: github.event_name == 'pull_request' && github.event.action == 'synchronize' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
join: true | |
channel: ${{ env.channel_noise }} | |
nickname: Pull-Request | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} updated PR #${{ github.event.pull_request.number }} | |
${{ env.TITLE }} | |
${{ github.event.pull_request.html_url }} | |
- name: irc opened issue | |
uses: mauke/[email protected] | |
if: github.event_name == 'issues' && github.event.action == 'opened' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: GH-Issue | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} opened issue #${{ github.event.issue.number }}: ${{ env.TITLE }} - ${{ github.event.issue.html_url }} | |
- name: irc reopened issue | |
uses: mauke/[email protected] | |
if: github.event_name == 'issues' && github.event.action == 'reopened' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: GH-Issue | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} reopened issue #${{ github.event.issue.number }}: ${{ env.TITLE }} - ${{ github.event.issue.html_url }} | |
- name: irc closed issue | |
uses: mauke/[email protected] | |
if: github.event_name == 'issues' && github.event.action == 'closed' | |
with: | |
server: ${{ env.server }} | |
port: ${{ env.port }} | |
tls: true | |
channel: ${{ env.channel_p5p }} | |
nickname: GH-Issue | |
message: |- | |
${{ env.color_orange }}${{ github.actor }}${{ env.color_clear }} closed issue #${{ github.event.issue.number }}: ${{ env.TITLE }} - ${{ github.event.issue.html_url }} |