@@ -9,22 +9,28 @@ and a yaml file with a list of jobs (or other links):
9
9
url: https://my-job.org/12345
10
10
```
11
11
12
- The action will inspect the file to determine lines that are newly added (compared to the parent commit)
13
- for a field of interest (e.g., the "url" attribute in a list of jobs), extract this field, and then post to a Slack channel.
12
+ The action will inspect the file to determine lines that are newly added (compared to a parent commit or second file)
13
+ for a field of interest (e.g., the "url" attribute in a list of jobs), extract this field, and then post to a Slack channel,
14
+ a Discord Channel, Twitter, or Mastodon.
14
15
15
16
![ img/example.png] ( img/example.png )
16
17
17
- This is custom made to help the [ US-RSE] ( https://github.com/US-RSE/usrse.github.io ) site
18
- to have job updates posted to slack!
18
+ This is custom made to help the [ hpc.social] ( https://hpc.social/jobs ) and [ US-RSE] ( https://github.com/US-RSE/usrse.github.io ) site
19
+ to have job updates posted to slack! If you'd like help setting this up for your group, please
20
+ ping [ @vsoch ] ( https://github.com/vsoch ) .
19
21
20
- ## Quickstart
21
22
22
- 1 . Create a [ webhook app] ( https://api.slack.com/messaging/webhooks#getting_started ) and grab the URL and save to ` SLACK_WEBHOOK ` in your repository secrets.
23
+ ## Usage
24
+
25
+ You'll generally want to:
26
+
27
+ 1 . Generate needed credentials for your apps of choice.
23
28
2 . Add a GitHub workflow file, as shown below, with your desired triggers.
24
29
25
- For more details on the above, keep reading.
30
+ More specifically, add a GitHub workflow file in ` .github/workflows ` to specify the following. Note that
31
+ the workflow below will do the check and update on any push to main (e.g., a merged pull request).
26
32
27
- ## 1. Slack Setup
33
+ ### Deploy to Slack
28
34
29
35
You'll want to [ follow the instructions here] ( https://api.slack.com/messaging/webhooks#getting_started ) to create a webhook
30
36
for your slack community and channel of interest. This usually means first creating an application and selecting your slack
@@ -39,21 +45,13 @@ curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"
39
45
```
40
46
41
47
Click on "Add new webhook to workspace" and then test the provided url with the bot. Copy the webhook URL
42
- and put it in a safe place. We will want to keep this URL as a secret in our eventual GitHub workflow.
43
-
44
-
45
- ## 2. Usage
46
-
47
- Add a GitHub workflow file in ` .github/workflows ` to specify the following. Note that
48
- the workflow below will do the check and update on any push to main (e.g., a merged pull request).
49
-
50
- ### Deploy to Slack
48
+ and save this to ` SLACK_WEBHOOK ` in your repository secrets.
51
49
52
50
``` yaml
53
51
on :
54
52
push :
55
53
paths :
56
- - ' _data/jobs.yml '
54
+ - ' _data/jobs.yaml '
57
55
branches :
58
56
- main
59
57
@@ -69,33 +67,33 @@ jobs:
69
67
- id : updater
70
68
name : Job Updater
71
69
uses : rseng/jobs-updater@main
72
- env :
73
- SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
74
70
with :
75
- filename : " _data/jobs.yml "
71
+ filename : " _data/jobs.yaml "
76
72
keys : " url,name"
77
73
unique : " url"
74
+ slack_webhook : ${{ secrets.SLACK_WEBHOOK }}
75
+ slack_deploy : true
78
76
79
77
- run : echo ${{ steps.updater.outputs.fields }}
80
78
name : Show New Jobs
81
79
shell : bash
82
80
` ` `
83
81
84
82
In the above, we will include the url and name fields, and use the url field to determine uniqueness (default).
85
- By default, given that you have the slack webhook in the environment, deployment will
86
- happen because deploy is true. If you just want to test, then do:
83
+ Given that you have the slack webhook as a secret provided to the action and ` deploy_slack` is true, the default `deploy`
84
+ variable (to indicate all services) is true and deployment will happen . If you just want to test, then do :
87
85
88
86
` ` ` yaml
89
87
...
90
88
- id: updater
91
89
name: Job Updater
92
90
uses: rseng/jobs-updater@main
93
- env :
94
- SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
95
91
with:
96
- filename : " _data/jobs.yml "
92
+ filename: "_data/jobs.yaml "
97
93
keys: "url"
98
94
deploy: false
95
+ slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
96
+ slack_deploy: true
99
97
` ` `
100
98
101
99
If you want to run a test run (meaning a random number of jobs will be selected that
@@ -106,12 +104,11 @@ aren't necessarily new) then add test:
106
104
- id: updater
107
105
name: Job Updater
108
106
uses: rseng/jobs-updater@main
109
- env :
110
- SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
111
107
with:
112
- filename : " _data/jobs.yml "
108
+ filename: "_data/jobs.yaml "
113
109
keys: "url"
114
110
test: true
111
+ slack_deploy: true
115
112
` ` `
116
113
117
114
If test is true, deploy will always be set to false.
@@ -123,17 +120,15 @@ to true, and also define all the needed environment variables in your repository
123
120
secrets.
124
121
125
122
` ` ` yaml
123
+ ...
126
124
- id: updater
127
125
name: Job Updater
128
126
uses: rseng/jobs-updater@add/deploy-arg
129
- env:
130
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
131
127
with:
132
- filename: "_data/jobs.yml "
128
+ filename: "_data/jobs.yaml "
133
129
keys: "url,name"
134
-
135
- deploy: true
136
130
test: false
131
+ slack_deploy: true
137
132
138
133
# Also deploy to Twitter (all secrets required in repository secrets)
139
134
twitter_deploy: true
@@ -153,13 +148,9 @@ secrets.
153
148
- id: updater
154
149
name: Job Updater
155
150
uses: rseng/jobs-updater@main
156
- env:
157
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
158
151
with:
159
- filename: "_data/jobs.yml "
152
+ filename: "_data/jobs.yaml "
160
153
key: "url"
161
-
162
- deploy: true
163
154
test: false
164
155
165
156
# Also deploy to Mastodon (all secrets required in repository secrets)
@@ -175,3 +166,56 @@ secrets.
175
166
mastodon_access_token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
176
167
mastodon_api_base_url: ${{ secrets.MASTODON_API_BASE_URL }}
177
168
` ` `
169
+
170
+ # ## Deploy to Discord
171
+
172
+ To deploy to Discord you will need to [create a webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks)
173
+ and then set `deploy_discord` to true, along with adding the webhook to your repository secrets as `DISCORD_WEBHOOK`.
174
+
175
+ ` ` ` yaml
176
+ - id: updater
177
+ name: Job Updater
178
+ uses: rseng/jobs-updater@main
179
+ with:
180
+ filename: "_data/jobs.yaml"
181
+ key: "url"
182
+ test: false
183
+ discord_deploy: true
184
+ discord_webhook: ${{ secrets.DISCORD_WEBHOOK }}
185
+ ` ` `
186
+
187
+ # # Variables
188
+
189
+ # ## Inputs
190
+
191
+ The following variables are available. You can also look at the [action.yml](action.yml).
192
+
193
+ | Name | Description | Required | Default |
194
+ |------|-------------|----------|---------|
195
+ | filename | The filename for the jobs | true | unset |
196
+ | previous_filename | The previous filename (for manual tesing or running alongside update) | false | unset |
197
+ | keys | Comma separated list of keys to post (defaults to url) | false | url |
198
+ | unique | Field to use to determine uniqueness | true | url |
199
+ | hashtag | A hashtag to use (defaults to `#Rseng`) | false | # RSEng |
200
+ | test | Test the updater (ensure there are jobs) | true | false |
201
+ | deploy | Global deploy across any service set to true? | true | true |
202
+ | slack_deploy | Deploy to Slack? | true | false |
203
+ | slack_webhook | Slack webhook to deploy to. | false | unset |
204
+ | discord_deploy | Deploy to Discord? | true | false |
205
+ | discord_webhook | Discord webhook to deploy to. | false | unset |
206
+ | twitter_deploy | Deploy to Twitter? | false | unset |
207
+ | twitter_api_key | API key generated for the user account to tweet | false | unset |
208
+ | twitter_api_secret |API secret generated for the user account to tweet | false | unset |
209
+ | twitter_consumer_key | Consumer key generated for the entire app | false | unset |
210
+ | twitter_consumer_secret | Consumer secret generated for the entire app | false | unset |
211
+ | mastodon_deploy | Boolean to deploy to Mastodon | false | unset |
212
+ | mastodon_access_token | API key generated for the user account to tweet | false | unset |
213
+ | mastodon_api_base_url | Base URL of the Mastodon instance to post to, e.g., https://fosstodon.org/ | false | unset |
214
+
215
+ # ## Outputs
216
+
217
+ | Name | Description |
218
+ |------|-------------|
219
+ | Fields (keys) parsed | The fields that are parsed in the jobs |
220
+ | Matrix | Matrix (list of lists) with value (index 1), icon (index 2) and full message (index 3) |
221
+ | Empty Matrix | true if empty, false otherwise |
0 commit comments