This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaction.yml
156 lines (150 loc) · 6.44 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: 'Feed To Social Media'
description: 'Post to social media whenever new item is found in a RSS/Atom feed'
author: 'Łukasz Wójcik'
branding:
icon: 'rss'
color: 'orange'
inputs:
# General settings
feedUrl:
description: 'URL of the feed to fetch'
required: true
newestItemStrategy:
description: 'Which item in the feed item array should be considered newest?'
default: 'latestDate'
cacheDirectory:
description: 'Path to the directory where cache files are stored'
default: 'cache'
cacheFileName:
description: 'Name of the file where cache data is stored'
default: 'feed-to-social-media.json'
postFormat:
description: 'Format of the post. See README for available tags'
default: '{title} {link}'
# Mastodon settings
mastodonEnable:
description: 'Enable posting to Mastodon?'
default: 'false'
mastodonPostFormat:
description: 'Format of the Mastodon post. Overrides postFormat if used'
mastodonInstance:
description: 'URL of the Mastodon instance to which the status should be sent'
mastodonAccessToken:
description: 'Access token for the Mastodon API'
mastodonPostVisibility:
description: 'Visibility setting for Mastodon posts'
default: 'public'
# Mastodon profile metadata settings
mastodonMetadataEnable:
description: 'Enable updating Mastodon profile metadata?'
default: 'false'
mastodonMetadataInstance:
description: 'URL of the Mastodon instance where profile metadata should be updated'
mastodonMetadataAccessToken:
description: 'Access token for the Mastodon API on the instance where profile metadata should be updated'
mastodonMetadataFieldIndex:
description: 'Index of the existing profile metadata field that should be updated (starting at 0)'
# Twitter settings
twitterEnable:
description: 'Enable posting to Twitter?'
default: 'false'
twitterPostFormat:
description: 'Format of the Twitter status. Overrides postFormat if used'
twitterApiKey:
description: 'Twitter API key'
twitterApiKeySecret:
description: 'Twitter API key secret'
twitterAccessToken:
description: 'Twitter API access token'
twitterAccessTokenSecret:
description: 'Twitter API access token secret'
# Discord settings
discordEnable:
description: 'Enable posting to Discord?'
default: 'false'
discordPostFormat:
description: 'Format of the Discord message. Overrides postFormat if used'
discordWebhookUrl:
description: 'Webhook URL to use for posting messages to Discord'
# Slack settings
slackEnable:
description: 'Enable posting to Slack?'
default: 'false'
slackPostFormat:
description: 'Format of the Slack message. Overrides postFormat if used'
slackWebhookUrl:
description: 'Webhook URL to use for posting messages to Slack'
# Bluesky settings
blueskyEnable:
description: 'Enable posting to Bluesky?'
default: 'false'
blueskyPostFormat:
description: 'Format of the Bluesky message. Overrides postFormat if used'
blueskyService:
description: 'Bluesky server URL'
default: 'https://bsky.social'
blueskyHandle:
description: 'Bluesky handle to post to (e.g. myaccount.bsky.social)'
blueskyAppPassword:
description: 'Bluesky app password'
blueskyOwnerHandle:
description: 'Your handle as a bot owner. This info will go in the bot user-agent string, so it will be visible to the server you connect (not displayed publicly)'
blueskyOwnerContact:
description: 'Your contact info as a bot owner. This info will go in the bot user-agent string, so it will be visible to the server you connect (not displayed publicly)'
outputs:
updateStatus:
description: 'Stringified object with update status'
value: ${{ steps.feed2sm.outputs.updateStatus }}
runs:
using: 'composite'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Feed to social media
run: node ${{ github.action_path }}/dist/index.js
shell: bash
env:
INPUT_FEEDURL: ${{ inputs.feedUrl }}
INPUT_NEWESTITEMSTRATEGY: ${{ inputs.newestItemStrategy }}
INPUT_CACHEDIRECTORY: ${{ inputs.cacheDirectory }}
INPUT_CACHEFILENAME: ${{ inputs.cacheFileName }}
INPUT_POSTFORMAT: ${{ inputs.postFormat }}
INPUT_MASTODONENABLE: ${{ inputs.mastodonEnable }}
INPUT_MASTODONPOSTFORMAT: ${{ inputs.mastodonPostFormat }}
INPUT_MASTODONINSTANCE: ${{ inputs.mastodonInstance }}
INPUT_MASTODONACCESSTOKEN: ${{ inputs.mastodonAccessToken }}
INPUT_MASTODONPOSTVISIBILITY: ${{ inputs.mastodonPostVisibility }}
INPUT_MASTODONMETADATAENABLE: ${{ inputs.mastodonMetadataEnable }}
INPUT_MASTODONMETADATAINSTANCE: ${{ inputs.mastodonMetadataInstance }}
INPUT_MASTODONMETADATAACCESSTOKEN: ${{ inputs.mastodonMetadataAccessToken }}
INPUT_MASTODONMETADATAFIELDINDEX: ${{ inputs.mastodonMetadataFieldIndex }}
INPUT_TWITTERENABLE: ${{ inputs.twitterEnable }}
INPUT_TWITTERPOSTFORMAT: ${{ inputs.twitterPostFormat }}
INPUT_TWITTERAPIKEY: ${{ inputs.twitterApiKey }}
INPUT_TWITTERAPIKEYSECRET: ${{ inputs.twitterApiKeySecret }}
INPUT_TWITTERACCESSTOKEN: ${{ inputs.twitterAccessToken }}
INPUT_TWITTERACCESSTOKENSECRET: ${{ inputs.twitterAccessTokenSecret }}
INPUT_DISCORDENABLE: ${{ inputs.discordEnable }}
INPUT_DISCORDPOSTFORMAT: ${{ inputs.discordPostFormat }}
INPUT_DISCORDWEBHOOKURL: ${{ inputs.discordWebhookUrl }}
INPUT_SLACKENABLE: ${{ inputs.slackEnable }}
INPUT_SLACKPOSTFORMAT: ${{ inputs.slackPostFormat }}
INPUT_SLACKWEBHOOKURL: ${{ inputs.slackWebhookUrl }}
INPUT_BLUESKYENABLE: ${{ inputs.blueskyEnable }}
INPUT_BLUESKYPOSTFORMAT: ${{ inputs.blueskyPostFormat }}
INPUT_BLUESKYHANDLE: ${{ inputs.blueskyHandle }}
INPUT_BLUESKYAPPPASSWORD: ${{ inputs.blueskyAppPassword }}
INPUT_BLUESKYOWNERHANDLE: ${{ inputs.blueskyOwnerHandle }}
INPUT_BLUESKYOWNERCONTACT: ${{ inputs.blueskyOwnerContact }}
- name: Pull any changes from Git
shell: bash
run: git pull
- name: Commit and push cache changes
shell: bash
run: |
cd .
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git diff --cached --exit-code || git commit -m "Update feed item cache" --author="${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
git push origin HEAD