Skip to content

Commit

Permalink
Fix Genuary workflow (#767)
Browse files Browse the repository at this point in the history
* Resolve the `attachment` undefined error
* Add names to workflow steps
  • Loading branch information
EthanThatOneKid committed Feb 8, 2023
1 parent b094347 commit ba4b9a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/update_genuary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ jobs:
steps:
- uses: actions/checkout@v2

- run: |
- name: Get pins
run: |
go run github.com/ethanthatonekid/pins@latest \
get -o /tmp/pins $GUILD_ID "channel_parent_id == $CHANNEL_ID"
go run github.com/ethanthatonekid/pins@latest get -o /tmp/pins 710225099923521558 "channel_parent_id == 1055675648296890388"

This comment has been minimized.

Copy link
@EthanThatOneKid

EthanThatOneKid Mar 9, 2023

Author Owner

@diamondburned why does it get invoked twice?

This comment has been minimized.

Copy link
@diamondburned

diamondburned Mar 9, 2023

Collaborator

Why do you have two go runs?

This comment has been minimized.

Copy link
@EthanThatOneKid

EthanThatOneKid Mar 9, 2023

Author Owner

Why do you have two go runs?

That’s what I am asking.

env:
GUILD_ID: ${{ secrets.GUILD_ID }}
CHANNEL_ID: ${{ secrets.GENUARY_CHANNEL_ID }}
DISCORD_TOKEN: ${{ secrets.GENUARY_DISCORD_TOKEN }}

- id: transform-genuary
- name: Transform Genuary data
id: transform-genuary
run: |
year=$(date +%Y)
echo "year=$year" >> $GITHUB_OUTPUT
Expand All @@ -35,7 +38,8 @@ jobs:
echo "updated=1" >> $GITHUB_OUTPUT
fi
- if: steps.transform-genuary.outputs.updated == 1
- name: Create pull request
if: steps.transform-genuary.outputs.updated == 1
uses: peter-evans/create-pull-request@v4
with:
title: |-
Expand Down
4 changes: 4 additions & 0 deletions scripts/transform-genuary.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ async function main() {
}

const attachment = pin.attachments[0];
if (!attachment) {
continue;
}

const src = attachment.proxy_url || null;
const alt = content.channel_names[pin.channel_id] || '';
if (!/^(\d+) /.test(alt)) {
Expand Down

0 comments on commit ba4b9a9

Please sign in to comment.