-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (67 loc) · 1.8 KB
/
get_last_discussion_url.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
# ## Summary
#
# 指定した "repo" で、タイトル名に "title" が含まれる最新の Discussion URL を返す。
# ## Usage
#
# name: Get last GitHub Discussion URL
#
# jobs:
# get-last-discussion-url:
# uses: route06/actions/.github/workflows/get_last_discussion_url.yml@v2
# with:
# title: Weekly meeting
# repo: route06/my-repo
# secrets:
# token: ${{ secrets.GITHUB_TOKEN }}
#
# show-url:
# needs: [get-last-discussion-url]
# runs-on: ubuntu-latest
# steps:
# - run: echo ${{ needs.get-last-discussion-url.outputs.url }}
name: Get last GitHub Discussion URL
on:
workflow_call:
inputs:
title:
description: 検索するdiscussionのタイトル 完全一致ではなく部分検索
required: true
type: string
repo:
description: リポジトリ名 e.g. route06/my-repo
required: true
type: string
secrets:
token:
required: true
outputs:
url:
value: ${{ jobs.get-last-discussion.outputs.url }}
permissions:
discussions: read
jobs:
get-last-discussion:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
url: ${{ fromJSON(steps.get_last_discussion.outputs.data).search.nodes[0].url }}
steps:
- id: get_last_discussion
name: Get Last discussion
uses: octokit/graphql-action@v2.x
with:
query: |
query LastDiscussion {
search(
type: DISCUSSION,
query: "repo:${{ inputs.repo }} in:title: \"${{ inputs.title }}\"",
last: 1) {
nodes {
... on Discussion {
url
}
}
}
}
env:
GITHUB_TOKEN: ${{ secrets.token }}