diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index d581c91..8ead2a1 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -15,7 +15,7 @@ jobs: - name: Install deps uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: xmlstarlet + packages: jq version: 1.0 - name: Run script diff --git a/crawl_news.sh b/crawl_news.sh index 0155bab..467c7e8 100644 --- a/crawl_news.sh +++ b/crawl_news.sh @@ -2,7 +2,7 @@ set -xe -OLD_FEED=./current.txt +OLD_FEED=./current.json CURRENT_FEED=$(mktemp -p /tmp crawl_feed.XXX) BOT_TOKEN=${BOT_TOKEN:=""} CHANNEL_ID=${CHANNEL_ID:="@dcss_news"} @@ -10,20 +10,20 @@ URL="https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" SHORT_COMMITS=$(mktemp -p /tmp crawl.XXXX) -wget https://github.com/crawl/crawl/commits/master.atom -O /tmp/master.atom +curl -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/crawl/crawl/commits?per_page=100" -o $CURRENT_FEED -xmlstarlet sel -N x=http://www.w3.org/2005/Atom -t -m "//x:entry" -v "x:content" -v "x:link/@href" -n -o "----" -n /tmp/master.atom | sed -e 's/&\|&/\&/g' -e 's/<\|<//g' -e 's/"\|"/"/g' -e "s/'\|'/'/g" -e 's/ | / /g' | grep -v '^$' | sed 's/^[ \t]*//' > $CURRENT_FEED + +# TODO: handle the case where one of message get lost(due to connection error or something) push_news() { DATA=$(echo "$1" | grep -v "^\s*$") - IFS=$'\n' read -rd '' HEADER LINK <<<"$DATA" - if [[ $(echo "$DATA" | wc -l ) == 2 ]] + if [[ $(echo "$DATA" | wc -l ) == 1 ]] then # TODO: normalize the string(converting html entities) - echo "${HEADER}" >> $SHORT_COMMITS + echo "$DATA" >> $SHORT_COMMITS else - curl -s -X POST "$URL" -d chat_id=$CHANNEL_ID -d parse_mode="HTML" -d text="${HEADER}"$'\n'"${LINK}" + curl -s -X POST "$URL" -d chat_id=$CHANNEL_ID -d parse_mode="HTML" -d text="$DATA" fi } @@ -32,9 +32,9 @@ export SHORT_COMMITS URL CHANNEL_ID if [ -f "$OLD_FEED" ] then - diff $OLD_FEED $CURRENT_FEED --changed-group-format="%>" --unchanged-group-format="" | tac -s $'\n----' | sed -e 's/----/\x0/' -e 's/<[^>]\+>//g' | xargs -0 -I{} -- bash -c 'push_news "$@"' _ {} + jq -s -r '(.[0] - .[1])[] | ( (.commit.message / "\n\n") as $msg | if ( $msg | length ) > 1 then ""+ $msg[0] + "", $msg[1:][], .html_url else "" + $msg[0] + "" end), "----"' "$CURRENT_FEED" "$OLD_FEED" | tac -s '----' | sed 's/----/\x0/' | xargs -0 -I{} -- bash -c 'push_news "$@"' _ {} else - tac -s $'\n----' $CURRENT_FEED | sed -e 's/----/\x0/' -e 's/<[^>]\+>//g' | xargs -0 -I{} -- bash -c 'push_news "$@"' _ {} + jq -r '.[] | ( (.commit.message / "\n\n") as $msg | if ( $msg | length ) > 1 then ""+ $msg[0] + "", $msg[1:][], .html_url else "" + $msg[0] + "" end), "----"' "$CURRENT_FEED" | tac -s '----' | sed 's/----/\x0/' | xargs -0 -I{} -- bash -c 'push_news "$@"' _ {} fi if [ -s "$SHORT_COMMITS" ]; then diff --git a/current.txt b/current.txt deleted file mode 100644 index 4049afb..0000000 --- a/current.txt +++ /dev/null @@ -1,167 +0,0 @@ -
Refactor more band leader code-https://github.com/crawl/crawl/commit/672eff3212572a203b58ffd4f1e2474d8a40fcfc ----- -
Refactor testing of band follower/leader relationships -A bunch of multi-line checks to props were being repeated in several -places, which are now more nicely wrapped up in a couple simple monster -methods. -Also splits the MF_BAND_MEMBER flag (which was effectively only used to -make band members talk 1/10th as often...) into MF_BAND_FOLLOWER and -MF_BAND_LEADER in preparation of some future behavioral tweaks to make it -less easy to pull followers away without their bands noticing.-https://github.com/crawl/crawl/commit/c8c0bed1baaa000d437fa49d50c82bea69c1940a ----- -
Make ability_name return string instead of const char* -I want to do some dynamic name construction inside that function, and it's -a lot more straightforward that way.-https://github.com/crawl/crawl/commit/fd3f6d62affe736c38878585be80cb52d54afcc9 ----- -
Fix minor wizmode bug with xp calculation -It still thought pacified monsters were worth 1/2 xp.-https://github.com/crawl/crawl/commit/63ff0dcbff59a9f42cc002b51873f9359f1e5c2d ----- -
Enter the mirror dimension -Instead of hardcoding a hand-made set of flipped weapon tiles, -generated flipped versions of every single doll weapon tile and use -*those* for dual-wielding monsters. (Ettins, blademasters, 2hos, etc.) -Arguably, we should use this tech for Frances? I'm not sure exactly -how, though. -Preparation for steel elves.-https://github.com/crawl/crawl/commit/8649878a938f6e263d233149ee192d4ca934b401 ----- -
Hide the "report this" metal statue description on banishment -Since it can't inherit the vault or layout's description or tile when -being moved to the Abyss. This also might also help with abyss_walk test -crashes?-https://github.com/crawl/crawl/commit/5f43475211510c3f4b5589a9ea9d0a61b4edb1e1 ----- -
Don't let Throw Ally throw tentacles (Lici) -If an iron giant throws the tentacle tip, it will cause a disconnecting -sever. If it throws the tentacle segments, an unattached tentacle segment -will sit on the floor for one turn before disappearing the next. Either -way, this is definitely undesired behaviour we can avoid in the slim cases -of Zot trap eldritch tentacles or charm / scrolls of summoning plus Malign -Gateway in Dis and a tiny number of vaults.-https://github.com/crawl/crawl/commit/722a80f8b5361e1520b1437c50af26a4167a1e7b ----- -
Fancify Zot and Pan a little more -This adds some experimental new bismuth-styled crystal tiles for Zot, with -a custom rainbow palette and a faint square impression from ontoclasm's old -labyrinth tiles- meant to reflect the varied elements and chaotic nature of -Zot. This also makes a bunch of trees and plants in Zot always place as -petrified, demonic, or withered- a lot of Zot monsters mention being quite -ancient (liches, moths of wrath) or primordial (orbs of fire) or both -(proteans), so leaning a bit more into being a realm sealed extremely long -ago feels rather appropriate compared to getting rather normal greenery -clashing with most of Zot's default palette, also. Zot should be dramatic! -(Also, threw some conduits in pan_disco_hall and fixed a missing floor -colouring there.)-https://github.com/crawl/crawl/commit/668cce9384e27f10377153529aa92af3a7606964 ----- -
Unbrace-https://github.com/crawl/crawl/commit/95bf75a7d52d13f2888b8da3dc40541f616d48bf ----- -
Don't crash in the abyss_walk test (DracoOmega) -Like the Abyss itself, this code unsettles me.-https://github.com/crawl/crawl/commit/bc18a39e1d331e9ad4f0d1bf801bf46c4a611c86 ----- -
Make groups of monsters handle diagonal chokepoints more consistently -Sometimes a monster that can attack the player will instead walk to the -side to let a friend move forward and help. For example, when fighting a -pack of yaks near the corner of a corridor -: ##### -: #.YYY -: #@### -: #.### -the lead yak has a 50% chance of moving west into the corner instead of -attacking the player. -This behavior didn't work right in one particular type of situation: -: ###YY -: ###YY -: ..Y## -: .@.## -: ...## -It used to be that the lead yak would never move south or west in such -a situation, even though in the similar situation with an extra wall -: ###YY -: ###YY -: ..Y## -: .@### -: ...## -it would have the expected 50% chance of moving west. (There was a similar -issue as well with the player moved one square north in the preceding two -diagrams.) -This commit tries to fix this, so you will no longer be safe fighting one -yak at a time in the second diagram above. Other behavior is hopefully -unchanged. -Note that in the situation -: ###YY -: ###YY -: .@Y## -: .#.## -: ...## -the yak will still never move south - this is because currently monsters -will only change their move by a 45 degree turn, not a 90 degree turn as -would be needed here. The goal of this commit isn't to make groups of -monsters as smart as possible, but just to fix a single weirdness/bug with -the old behavior.-https://github.com/crawl/crawl/commit/5b1be31b7c0034f75dced2615ea910b423d4b129 ----- -
Ghost / illusion Starburst -> Bolt of Fire -This follows the same spirit as Necrotise -> Pain, Confusing Touch -> -Confuse, Curse of Agony -> Agony, Dragon's Call -> Summon Dragon, and so -on, of being very close in sharing the same core mechanic (penetrating -fire beam here) while being awkward for monsters to get directly (they'd -shred all of their allies, aligning in the 8 directions is awkward for -mobile monsters). Helps continue to maintain Illusion Card and Mara -Illusions, plus continues to help player ghosts not fall too hard behind -from the present day. -Also, slightly resort the translated spell list in ascending spell-level -order, since this list is starting to get kinda long.-https://github.com/crawl/crawl/commit/29182dc2f909c01e6f77e50bc8ea1d9d383ea9b8 ----- -
Add a Ghoul title -In the spirit of ccc5534 and e618eea and so on, it feels suiting to have -the current strongest of the corporeal undead anthrophage monsters be -reflected in the player titles too. Nicely dramatic for anybody who wants -to max out a -2 apt, anyway.-https://github.com/crawl/crawl/commit/d980ff381834cb715eee9518c753764da4715c2d ----- -
task: remove the 0.31 trunk tournament reminder -This reverts commit e66fa4eb29bf7b720200d5fbfce887e1803ce131.-https://github.com/crawl/crawl/commit/0d27ed53bc5217451b60f342032219c965a9aa25 ----- -
Add "Royal Mummy" title-https://github.com/crawl/crawl/commit/4c9cb3f8ddb1619aba4b7da2776c75c85bad5c4a ----- -
Move monsters into YAML -For hopefully better readability and editability, without having -to cross-reference obscure fields.-https://github.com/crawl/crawl/commit/5b44be1ddb685f4f29a3c56d8fed4afaf7c9e86f ----- -
Add C, J, R, and U death messages (Oneirical, #3452) -Jiyva's messages only make sense if the player left a corpse, so -they're adjusted for that.-https://github.com/crawl/crawl/commit/0f96f66c9d61727ab36b05dfa5726edb6fb5fdb6 ----- -
Add Hepliaklqana and Ignis death messages.-https://github.com/crawl/crawl/commit/6d6becde815236b29eeece03fb36cead8672c5b1 ----- -
Make all gods use death messages if available. -This restructures _god_death_message(), and renames it -_god_death_messages(), since it can now display multiple messages. -The Xom message, the Gozag gold message, the Okawaru duel message, the -Beogh heretic priest message (extended to account for if you ever -worshipped Beogh, and calling you an apostate instead if you abandoned -him), and the Nemelex death message (now only shown if you left a -corpse) are displayed after any death messages from the database.-https://github.com/crawl/crawl/commit/59d7447d90d75552eb67bfcf010e6d35857eb25c ----- -
Add database key handling to god death msgs. -The default death message for any god will be "@God_name@ death". -Anything specific to leaving a corpse, having undead holiness, or having -nonliving holiness is specified by the appended keys "corpse", "undead", -and "nonliving". -Add a few god speech aliases to account for this.-https://github.com/crawl/crawl/commit/10d5f734ec99684a27588d1d3b592e03e673121a -----