From 72cf002de0efec708da0cf06e09399f49767a94c Mon Sep 17 00:00:00 2001 From: tomcky Date: Sat, 6 Jul 2024 00:15:54 +0900 Subject: [PATCH 01/29] =?UTF-8?q?description=20template=20file=E3=81=8C?= =?UTF-8?q?=E7=A9=BA=E3=81=A7=E3=82=82=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=82=89=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=E6=96=87=E5=AD=97?= =?UTF-8?q?=E5=88=97=E3=82=92=E5=85=A5=E3=82=8C=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create_discussion.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create_discussion.yml b/.github/workflows/create_discussion.yml index 29d90f3..e15dd91 100644 --- a/.github/workflows/create_discussion.yml +++ b/.github/workflows/create_discussion.yml @@ -118,7 +118,18 @@ jobs: ) const discussionTitle = `${TARGET_DATE} ${TITLE}`; - const description = fs.readFileSync(DESCRIPTION_TEMPLATE_PATH, "utf8"); + + let description; + try { + description = fs.readFileSync(DESCRIPTION_TEMPLATE_PATH, "utf8"); + if (!description) { + console.warn('Description file is empty, using default description.'); + description = 'Default description text'; + } + } catch (error) { + console.error("Error reading description template file:", error); + process.exit(1); + } const discussionId = await createWeeklyReportDiscussion( github, From 83426dc9edc2e23f8e5e3ed188c50e522453bb5f Mon Sep 17 00:00:00 2001 From: tomcky Date: Sat, 6 Jul 2024 01:21:53 +0900 Subject: [PATCH 02/29] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E6=97=A5=E4=BB=98=E4=BB=98=E4=B8=8E=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=82=92workflow=E3=81=8B=E3=82=89=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create_discussion.yml | 52 ++++++++++++++----------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/.github/workflows/create_discussion.yml b/.github/workflows/create_discussion.yml index e15dd91..caf320f 100644 --- a/.github/workflows/create_discussion.yml +++ b/.github/workflows/create_discussion.yml @@ -2,15 +2,32 @@ # # on: # schedule: -# - cron: "0 0 * * mon" +# # 毎週水曜 13:00 JST +# - cron: "0 4 * * wed" +# +# env: +# # NOTE: MTG開催曜日に合わせて変更してください +# TARGET_DAY: "wednesday" +# # jobs: # create_discussion: -# uses: route06/actions/.github/workflows/create_discussion.yml@v2 -# with: -# target_day: sunday -# title: ハドル -# discussion_category_slug: meeting-notes -# description_template_path: _templates/weekly_meeting_discussion/test.md +# runs-on: ubuntu-latest +# timeout-minutes: 10 +# env: +# TZ: "Asia/Tokyo" +# steps: +# - name: Get next meeting date +# id: get_date +# run: | +# target_date=$(date -d "next $TARGET_DAY" +%Y/%m/%d) +# echo "target_date=$target_date" >> "$GITHUB_OUTPUT" +# +# - name: Run create discussion workflow +# uses: route06/actions/.github/workflows/create_discussion.yml@v2 +# with: +# title: ${{ steps.get_date.outputs.target_date }} Meeting Title +# discussion_category_slug: meeting-notes +# description_template_path: _templates/weekly_meeting_discussion/test.md # # 補足: # discussion_category_slug は各カテゴリを選択した時の、URL 末尾の文字列です。以下は例です。 @@ -24,12 +41,8 @@ name: Create discussion on: workflow_call: inputs: - target_day: - description: MTG開催曜日に合わせて変更してください。 - required: true - type: string title: - description: 作成するDiscussionのタイトルを設定してください(yyyy/mm/dd が接頭辞として自動付与されます)。 + description: 作成するDiscussionのタイトルを設定してください。 required: true type: string discussion_category_slug: @@ -51,15 +64,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: "Get next meeting date" - id: get_date - run: | - target_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) - echo "target_date=$target_date" >> "$GITHUB_OUTPUT" - - name: Run script env: - TARGET_DATE: ${{ steps.get_date.outputs.target_date }} REPOSITORY: ${{ github.repository }} DISCUSSION_CATEGORY_SLUG: ${{ inputs.discussion_category_slug }} TITLE: ${{ inputs.title }} @@ -92,7 +98,7 @@ jobs: return {repositoryId: result.repository.id, categoryId: result.repository.discussionCategory.id}; } - async function createWeeklyReportDiscussion(github, repositoryId, categoryId, title, description) { + async function createMyDiscussion(github, repositoryId, categoryId, title, description) { const result = await github.graphql(`mutation($repositoryId:ID!, $categoryId:ID!, $title:String!, $body:String!) { createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) { discussion { @@ -107,7 +113,7 @@ jobs: }); } - const { REPOSITORY, DISCUSSION_CATEGORY_SLUG, TARGET_DATE, TITLE, DESCRIPTION_TEMPLATE_PATH } = process.env; + const { REPOSITORY, DISCUSSION_CATEGORY_SLUG, TITLE, DESCRIPTION_TEMPLATE_PATH } = process.env; const [owner, repositoryName] = REPOSITORY.split('/'); const repositoryIdAndCategoryId = await featchRepoIdAndDiscussionCategoryId( @@ -117,7 +123,7 @@ jobs: DISCUSSION_CATEGORY_SLUG, ) - const discussionTitle = `${TARGET_DATE} ${TITLE}`; + const discussionTitle = TITLE; let description; try { @@ -131,7 +137,7 @@ jobs: process.exit(1); } - const discussionId = await createWeeklyReportDiscussion( + const discussionId = await createMyDiscussion( github, repositoryIdAndCategoryId.repositoryId, repositoryIdAndCategoryId.categoryId, From 7f3562ed381ddaf38bb5815bdb791a64cba7372e Mon Sep 17 00:00:00 2001 From: tomcky Date: Sun, 7 Jul 2024 01:59:55 +0900 Subject: [PATCH 03/29] =?UTF-8?q?usage=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create_discussion.yml | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create_discussion.yml b/.github/workflows/create_discussion.yml index caf320f..edcc5c8 100644 --- a/.github/workflows/create_discussion.yml +++ b/.github/workflows/create_discussion.yml @@ -1,8 +1,11 @@ +# todo: 以下はStarter Workflow化する # @usage # +# name: Create discussion +# # on: # schedule: -# # 毎週水曜 13:00 JST +# # 毎週水曜 13:00 JST に実行 # - cron: "0 4 * * wed" # # env: @@ -10,7 +13,7 @@ # TARGET_DAY: "wednesday" # # jobs: -# create_discussion: +# get_next_meeting_date: # runs-on: ubuntu-latest # timeout-minutes: 10 # env: @@ -21,13 +24,19 @@ # run: | # target_date=$(date -d "next $TARGET_DAY" +%Y/%m/%d) # echo "target_date=$target_date" >> "$GITHUB_OUTPUT" -# -# - name: Run create discussion workflow -# uses: route06/actions/.github/workflows/create_discussion.yml@v2 -# with: -# title: ${{ steps.get_date.outputs.target_date }} Meeting Title -# discussion_category_slug: meeting-notes -# description_template_path: _templates/weekly_meeting_discussion/test.md +# outputs: +# target_date: ${{ steps.get_date.outputs.target_date }} +# +# create_discussion: +# needs: get_next_meeting_date +# uses: route06/actions/.github/workflows/create_discussion.yml@update-create-discussion-workflow-1 +# with: +# # NOTE: 作成するDiscussionのタイトルを指定 +# title: ${{ needs.get_next_meeting_date.outputs.target_date }} Meeting Title +# # NOTE: discussion_category_slugについては補足参照 +# discussion_category_slug: meeting-notes +# # NOTE: 作成するDiscussionで使用するテンプレートファイルのパスを指定 +# description_template_path: _templates/weekly_meeting_discussion/test.md # # 補足: # discussion_category_slug は各カテゴリを選択した時の、URL 末尾の文字列です。以下は例です。 From a2fbbfd06214418553f723743964b89f8f46bb51 Mon Sep 17 00:00:00 2001 From: tomcky Date: Mon, 8 Jul 2024 21:16:45 +0900 Subject: [PATCH 04/29] Update .github/workflows/create_discussion.yml Co-authored-by: Takashi Masuda --- .github/workflows/create_discussion.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create_discussion.yml b/.github/workflows/create_discussion.yml index edcc5c8..445e1ad 100644 --- a/.github/workflows/create_discussion.yml +++ b/.github/workflows/create_discussion.yml @@ -134,17 +134,21 @@ jobs: const discussionTitle = TITLE; - let description; - try { - description = fs.readFileSync(DESCRIPTION_TEMPLATE_PATH, "utf8"); - if (!description) { - console.warn('Description file is empty, using default description.'); - description = 'Default description text'; + const description = (() => { + const DEFAULT_DESCRIPTION = ''; + try { + const desc = fs.readFileSync(DESCRIPTION_TEMPLATE_PATH, "utf8"); + return desc.trim() === '' ? DEFAULT_DESCRIPTION : desc; + } catch (error) { + if (error.code === 'ENOENT') { + console.error("Error reading description template file:", error); + return DEFAULT_DESCRIPTION; + } + else { + throw error; + } } - } catch (error) { - console.error("Error reading description template file:", error); - process.exit(1); - } + })(); const discussionId = await createMyDiscussion( github, From 1461a4f1adfe0b5c66c81c0a57161e47acfe19a6 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Wed, 10 Jul 2024 12:57:33 +0900 Subject: [PATCH 05/29] Make it clear that this is a GitHub Discussion --- .../{create_discussion.yml => create_gh_discussion.yml} | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{create_discussion.yml => create_gh_discussion.yml} (98%) diff --git a/.github/workflows/create_discussion.yml b/.github/workflows/create_gh_discussion.yml similarity index 98% rename from .github/workflows/create_discussion.yml rename to .github/workflows/create_gh_discussion.yml index 445e1ad..289c5f7 100644 --- a/.github/workflows/create_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -29,7 +29,7 @@ # # create_discussion: # needs: get_next_meeting_date -# uses: route06/actions/.github/workflows/create_discussion.yml@update-create-discussion-workflow-1 +# uses: route06/actions/.github/workflows/create_gh_discussion.yml@update-create-discussion-workflow-1 # with: # # NOTE: 作成するDiscussionのタイトルを指定 # title: ${{ needs.get_next_meeting_date.outputs.target_date }} Meeting Title diff --git a/README.md b/README.md index 3280b8a..4b55976 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ROUTE06内外から使われることを想定したGitHub ActionsのReusable Wo * [add_assignee_to_pr.yml](./.github/workflows/add_assignee_to_pr.yml) * [codeql.yml](./.github/workflows/codeql.yml) -* [create_discussion.yml](./.github/workflows/create_discussion.yml) +* [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) * [get_last_discussion_url.yml](./.github/workflows/get_last_discussion_url.yml) * [gh_discussion_comment_to_slack.yml](./.github/workflows/gh_discussion_comment_to_slack.yml) * [notify_slack_on_ci_failed.yml](./.github/workflows/notify_slack_on_ci_failed.yml) From bb3448fd752f45f880fb497506ceb8eb0f3f7dfd Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Wed, 10 Jul 2024 13:01:50 +0900 Subject: [PATCH 06/29] Fix usage --- .github/workflows/create_gh_discussion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 289c5f7..5a8b114 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -29,7 +29,7 @@ # # create_discussion: # needs: get_next_meeting_date -# uses: route06/actions/.github/workflows/create_gh_discussion.yml@update-create-discussion-workflow-1 +# uses: route06/actions/.github/workflows/create_gh_discussion.yml@v2 # with: # # NOTE: 作成するDiscussionのタイトルを指定 # title: ${{ needs.get_next_meeting_date.outputs.target_date }} Meeting Title From 42814f109e9aa647e81c867e516f00c91373abef Mon Sep 17 00:00:00 2001 From: tomcky Date: Wed, 17 Jul 2024 11:46:32 +0900 Subject: [PATCH 07/29] =?UTF-8?q?=E3=82=B9=E3=82=B1=E3=82=B8=E3=83=A5?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E3=81=95=E3=82=8C=E3=81=9F=E6=AC=A1=E3=81=AE?= =?UTF-8?q?=E6=97=A5=E4=BB=98=E3=82=92=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD=E3=83=BC=E3=82=92?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/get_next_scheduled_date.yml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/get_next_scheduled_date.yml diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml new file mode 100644 index 0000000..7b86cf4 --- /dev/null +++ b/.github/workflows/get_next_scheduled_date.yml @@ -0,0 +1,92 @@ +# @usage +# +# name: Get next scheduled date +# +# on: +# workflow_dispatch: +# +# jobs: +# get_next_weekly_scheduled_date: +# uses: route06/actions/.github/workflows/get_next_scheduled_date.yml@test-calculate-next-date +# with: +# target_schedule: weekly +# target_day: wednesday +# +# log_result: +# runs-on: ubuntu-latest +# needs: [get_next_weekly_scheduled_date] +# steps: +# - name: Log the next scheduled date +# run: | +# echo "The next weekly schedule date is: ${{ needs.get_next_weekly_scheduled_date.outputs.next_scheduled_date }}" + +name: Get next scheduled date + +on: + workflow_call: + inputs: + target_schedule: + description: daily, weekly, monthly, yearlyのいずれかを指定してください。 + default: weekly + type: string + target_day: + description: 週次の場合の対象曜日を指定してください。 + default: monday + type: string + target_date: + description: 月次の場合の対象日を指定してください。 + default: "1" + type: string + target_yearly_date: + description: 年次の場合の対象月日を指定してください。 + default: 01-01 + type: string + time_zone: + description: タイムゾーンを指定してください。 + default: "Asia/Tokyo" + type: string + outputs: + next_scheduled_date: + description: yyyy/mm/dd形式で日付を返します。 + value: ${{ jobs.get_next_scheduled_date.outputs.next_scheduled_date }} + +jobs: + get_next_scheduled_date: + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + TZ: ${{ inputs.time_zone }} + steps: + - name: Run script + id: get_date + run: | + if [ "${{ inputs.target_schedule }}" = "daily" ]; then + next_scheduled_date=$(date -d "tomorrow" +%Y/%m/%d) + elif [ "${{ inputs.target_schedule }}" = "weekly" ]; then + next_scheduled_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) + elif [ "${{ inputs.target_schedule }}" = "monthly" ]; then + today=$(date +%d) + if [ "$today" -lt "${{ inputs.target_date }}" ]; then + next_scheduled_date=$(date -d "$(date +%Y-%m-)${{ inputs.target_date }}" +%Y/%m/%d) + else + next_scheduled_date=$(date -d "$(date +%Y-%m-01) +1 month +$((${{ inputs.target_date }}-1)) days" +%Y/%m/%d) + fi + elif [ "${{ inputs.target_schedule }}" = "yearly" ]; then + current_year=$(date +%Y) + current_month_day=$(date +%m-%d) + if [ "$current_month_day" = "${{ inputs.target_yearly_date }}" ]; then + next_scheduled_date=$(date -d "$current_year-${{ inputs.target_yearly_date }} +1 year" +%Y/%m/%d) + else + if [ "$current_month_day" -lt "${{ inputs.target_yearly_date }}" ]; then + next_scheduled_date=$(date -d "$current_year-${{ inputs.target_yearly_date }}" +%Y/%m/%d) + else + next_scheduled_date=$(date -d "$((current_year + 1))-${{inputs.target_yearly_date }}" +%Y/%m/%d) + fi + fi + else + echo "Invalid TARGET_SCHEDULE value" + exit 1 + fi + echo "next_scheduled_date=$next_scheduled_date" >> "$GITHUB_OUTPUT" + outputs: + next_scheduled_date: ${{ steps.get_date.outputs.next_scheduled_date }} \ No newline at end of file From a5ae7d4e2435606e252a363ad9f75fc7544628b2 Mon Sep 17 00:00:00 2001 From: tomcky Date: Wed, 17 Jul 2024 12:17:27 +0900 Subject: [PATCH 08/29] =?UTF-8?q?=E6=BC=94=E7=AE=97=E5=AD=90=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/get_next_scheduled_date.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index 7b86cf4..e8ef8f2 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -66,7 +66,7 @@ jobs: next_scheduled_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) elif [ "${{ inputs.target_schedule }}" = "monthly" ]; then today=$(date +%d) - if [ "$today" -lt "${{ inputs.target_date }}" ]; then + if [ "$today" \< "${{ inputs.target_date }}" ]; then next_scheduled_date=$(date -d "$(date +%Y-%m-)${{ inputs.target_date }}" +%Y/%m/%d) else next_scheduled_date=$(date -d "$(date +%Y-%m-01) +1 month +$((${{ inputs.target_date }}-1)) days" +%Y/%m/%d) @@ -77,7 +77,7 @@ jobs: if [ "$current_month_day" = "${{ inputs.target_yearly_date }}" ]; then next_scheduled_date=$(date -d "$current_year-${{ inputs.target_yearly_date }} +1 year" +%Y/%m/%d) else - if [ "$current_month_day" -lt "${{ inputs.target_yearly_date }}" ]; then + if [ "$current_month_day" \< "${{ inputs.target_yearly_date }}" ]; then next_scheduled_date=$(date -d "$current_year-${{ inputs.target_yearly_date }}" +%Y/%m/%d) else next_scheduled_date=$(date -d "$((current_year + 1))-${{inputs.target_yearly_date }}" +%Y/%m/%d) From d261c5c332005d5c05be291e30552b65bba900e8 Mon Sep 17 00:00:00 2001 From: tomcky Date: Wed, 17 Jul 2024 12:18:01 +0900 Subject: [PATCH 09/29] =?UTF-8?q?=E6=9C=AB=E5=B0=BE=E6=94=B9=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/get_next_scheduled_date.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index e8ef8f2..45e6ac9 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -89,4 +89,4 @@ jobs: fi echo "next_scheduled_date=$next_scheduled_date" >> "$GITHUB_OUTPUT" outputs: - next_scheduled_date: ${{ steps.get_date.outputs.next_scheduled_date }} \ No newline at end of file + next_scheduled_date: ${{ steps.get_date.outputs.next_scheduled_date }} From 671ad1b4bdd44e082760f6a2edf82def5f3ed099 Mon Sep 17 00:00:00 2001 From: tomcky Date: Fri, 19 Jul 2024 14:17:27 +0900 Subject: [PATCH 10/29] Update .github/workflows/get_next_scheduled_date.yml Co-authored-by: Takashi Masuda --- .github/workflows/get_next_scheduled_date.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index 45e6ac9..d5e0ab5 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -7,7 +7,7 @@ # # jobs: # get_next_weekly_scheduled_date: -# uses: route06/actions/.github/workflows/get_next_scheduled_date.yml@test-calculate-next-date +# uses: route06/actions/.github/workflows/get_next_scheduled_date.yml@v2 # with: # target_schedule: weekly # target_day: wednesday From f6069103a8d61c57acb806738dc8b133f30b76b4 Mon Sep 17 00:00:00 2001 From: tomcky Date: Fri, 19 Jul 2024 21:31:44 +0900 Subject: [PATCH 11/29] =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=91=E3=83=86?= =?UTF-8?q?=E3=82=A3=E5=90=8D=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/get_next_scheduled_date.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index d5e0ab5..eebeb70 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -9,7 +9,7 @@ # get_next_weekly_scheduled_date: # uses: route06/actions/.github/workflows/get_next_scheduled_date.yml@v2 # with: -# target_schedule: weekly +# interval: weekly # target_day: wednesday # # log_result: @@ -25,7 +25,7 @@ name: Get next scheduled date on: workflow_call: inputs: - target_schedule: + interval: description: daily, weekly, monthly, yearlyのいずれかを指定してください。 default: weekly type: string @@ -60,18 +60,18 @@ jobs: - name: Run script id: get_date run: | - if [ "${{ inputs.target_schedule }}" = "daily" ]; then + if [ "${{ inputs.interval }}" = "daily" ]; then next_scheduled_date=$(date -d "tomorrow" +%Y/%m/%d) - elif [ "${{ inputs.target_schedule }}" = "weekly" ]; then + elif [ "${{ inputs.interval }}" = "weekly" ]; then next_scheduled_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) - elif [ "${{ inputs.target_schedule }}" = "monthly" ]; then + elif [ "${{ inputs.interval }}" = "monthly" ]; then today=$(date +%d) if [ "$today" \< "${{ inputs.target_date }}" ]; then next_scheduled_date=$(date -d "$(date +%Y-%m-)${{ inputs.target_date }}" +%Y/%m/%d) else next_scheduled_date=$(date -d "$(date +%Y-%m-01) +1 month +$((${{ inputs.target_date }}-1)) days" +%Y/%m/%d) fi - elif [ "${{ inputs.target_schedule }}" = "yearly" ]; then + elif [ "${{ inputs.interval }}" = "yearly" ]; then current_year=$(date +%Y) current_month_day=$(date +%m-%d) if [ "$current_month_day" = "${{ inputs.target_yearly_date }}" ]; then @@ -84,7 +84,7 @@ jobs: fi fi else - echo "Invalid TARGET_SCHEDULE value" + echo "Invalid INTERVAL value" exit 1 fi echo "next_scheduled_date=$next_scheduled_date" >> "$GITHUB_OUTPUT" From d895faf069376fd48652615d48cb730389c589a2 Mon Sep 17 00:00:00 2001 From: tomcky Date: Fri, 19 Jul 2024 21:33:30 +0900 Subject: [PATCH 12/29] =?UTF-8?q?README=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4b55976..8facb38 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ ROUTE06内外から使われることを想定したGitHub ActionsのReusable Wo * [codeql.yml](./.github/workflows/codeql.yml) * [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) * [get_last_discussion_url.yml](./.github/workflows/get_last_discussion_url.yml) +* [get_next_scheduled_date.yml](./.github/workflows/get_next_scheduled_date.yml) * [gh_discussion_comment_to_slack.yml](./.github/workflows/gh_discussion_comment_to_slack.yml) * [notify_slack_on_ci_failed.yml](./.github/workflows/notify_slack_on_ci_failed.yml) From 7c54d96e4bc8a8cda8d45caab0d83e3632eeeefc Mon Sep 17 00:00:00 2001 From: tomcky Date: Fri, 19 Jul 2024 21:39:25 +0900 Subject: [PATCH 13/29] =?UTF-8?q?if=E6=96=87=E3=82=92case=E6=96=87?= =?UTF-8?q?=E3=81=AB=E6=9B=B8=E3=81=8D=E6=8F=9B=E3=81=88=E3=80=81monthly?= =?UTF-8?q?=E3=81=A8yearly=E3=81=AE=E5=AF=BE=E5=BF=9C=E3=82=92=E3=82=B9?= =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=97=E3=82=A2=E3=82=A6=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/get_next_scheduled_date.yml | 43 +++++-------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index eebeb70..1e7574b 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -26,21 +26,13 @@ on: workflow_call: inputs: interval: - description: daily, weekly, monthly, yearlyのいずれかを指定してください。 + description: daily, weeklyのいずれかを指定してください。 default: weekly type: string target_day: description: 週次の場合の対象曜日を指定してください。 default: monday type: string - target_date: - description: 月次の場合の対象日を指定してください。 - default: "1" - type: string - target_yearly_date: - description: 年次の場合の対象月日を指定してください。 - default: 01-01 - type: string time_zone: description: タイムゾーンを指定してください。 default: "Asia/Tokyo" @@ -60,33 +52,18 @@ jobs: - name: Run script id: get_date run: | - if [ "${{ inputs.interval }}" = "daily" ]; then + case "${{ inputs.interval }}" in + "daily") next_scheduled_date=$(date -d "tomorrow" +%Y/%m/%d) - elif [ "${{ inputs.interval }}" = "weekly" ]; then + ;; + "weekly") next_scheduled_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) - elif [ "${{ inputs.interval }}" = "monthly" ]; then - today=$(date +%d) - if [ "$today" \< "${{ inputs.target_date }}" ]; then - next_scheduled_date=$(date -d "$(date +%Y-%m-)${{ inputs.target_date }}" +%Y/%m/%d) - else - next_scheduled_date=$(date -d "$(date +%Y-%m-01) +1 month +$((${{ inputs.target_date }}-1)) days" +%Y/%m/%d) - fi - elif [ "${{ inputs.interval }}" = "yearly" ]; then - current_year=$(date +%Y) - current_month_day=$(date +%m-%d) - if [ "$current_month_day" = "${{ inputs.target_yearly_date }}" ]; then - next_scheduled_date=$(date -d "$current_year-${{ inputs.target_yearly_date }} +1 year" +%Y/%m/%d) - else - if [ "$current_month_day" \< "${{ inputs.target_yearly_date }}" ]; then - next_scheduled_date=$(date -d "$current_year-${{ inputs.target_yearly_date }}" +%Y/%m/%d) - else - next_scheduled_date=$(date -d "$((current_year + 1))-${{inputs.target_yearly_date }}" +%Y/%m/%d) - fi - fi - else + ;; + *) echo "Invalid INTERVAL value" exit 1 - fi + ;; + esac echo "next_scheduled_date=$next_scheduled_date" >> "$GITHUB_OUTPUT" outputs: - next_scheduled_date: ${{ steps.get_date.outputs.next_scheduled_date }} + next_scheduled_date: ${{ steps.get_date.outputs.next_scheduled_date }} From 0517f4bf371b1f612a825c492095da5d406e7c45 Mon Sep 17 00:00:00 2001 From: tomcky Date: Wed, 24 Jul 2024 14:54:13 +0900 Subject: [PATCH 14/29] Update .github/workflows/get_next_scheduled_date.yml Co-authored-by: Takashi Masuda --- .github/workflows/get_next_scheduled_date.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index 1e7574b..ee68fc9 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -12,7 +12,7 @@ # interval: weekly # target_day: wednesday # -# log_result: +# log_result: # runs-on: ubuntu-latest # needs: [get_next_weekly_scheduled_date] # steps: From 126083fa116ac6ac90e1ca01a2954cba7509b46f Mon Sep 17 00:00:00 2001 From: tomcky Date: Wed, 24 Jul 2024 14:55:19 +0900 Subject: [PATCH 15/29] Update .github/workflows/get_next_scheduled_date.yml Co-authored-by: Takashi Masuda --- .github/workflows/get_next_scheduled_date.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index ee68fc9..1e1f5d5 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -27,8 +27,8 @@ on: inputs: interval: description: daily, weeklyのいずれかを指定してください。 - default: weekly type: string + required: true target_day: description: 週次の場合の対象曜日を指定してください。 default: monday From 3d27a05003b51202bdf645f9f437d29e5833d993 Mon Sep 17 00:00:00 2001 From: tomcky Date: Wed, 24 Jul 2024 14:55:34 +0900 Subject: [PATCH 16/29] Update .github/workflows/get_next_scheduled_date.yml Co-authored-by: Takashi Masuda --- .github/workflows/get_next_scheduled_date.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/get_next_scheduled_date.yml index 1e1f5d5..6708f11 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/get_next_scheduled_date.yml @@ -30,7 +30,7 @@ on: type: string required: true target_day: - description: 週次の場合の対象曜日を指定してください。 + description: intervalがweeklyの時は必須です。対象曜日を指定してください。 default: monday type: string time_zone: From df5aa74bc5ed84aceb74e4f5bfe0297306e54fc5 Mon Sep 17 00:00:00 2001 From: tomcky Date: Tue, 30 Jul 2024 21:13:31 +0900 Subject: [PATCH 17/29] =?UTF-8?q?=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E5=80=99=E8=A3=9C=E7=89=88=E3=81=A8=E3=81=97=E3=81=A6README?= =?UTF-8?q?=E3=81=AB=E8=A8=98=E8=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8facb38..f99652b 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,17 @@ ROUTE06内外から使われることを想定したGitHub ActionsのReusable Wo * [add_assignee_to_pr.yml](./.github/workflows/add_assignee_to_pr.yml) * [codeql.yml](./.github/workflows/codeql.yml) -* [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) * [get_last_discussion_url.yml](./.github/workflows/get_last_discussion_url.yml) -* [get_next_scheduled_date.yml](./.github/workflows/get_next_scheduled_date.yml) * [gh_discussion_comment_to_slack.yml](./.github/workflows/gh_discussion_comment_to_slack.yml) * [notify_slack_on_ci_failed.yml](./.github/workflows/notify_slack_on_ci_failed.yml) +### Release Candidate + +利用可能ですが、最終的なテストやフィードバック待ちのバージョンとなります。 + +* [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) +* [get_next_scheduled_date.yml](./.github/workflows/get_next_scheduled_date.yml) + ## 開発者向け ### ADR From 7468697cd6fe4ceef94a4bcf8bf6ad3e9ba3e1b5 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Wed, 31 Jul 2024 12:23:52 +0900 Subject: [PATCH 18/29] It is not necessary to know that this workflow is "scheduled" --- ..._scheduled_date.yml => calc_next_date.yml} | 30 +++++++++---------- README.md | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) rename .github/workflows/{get_next_scheduled_date.yml => calc_next_date.yml} (57%) diff --git a/.github/workflows/get_next_scheduled_date.yml b/.github/workflows/calc_next_date.yml similarity index 57% rename from .github/workflows/get_next_scheduled_date.yml rename to .github/workflows/calc_next_date.yml index 6708f11..dd4ec36 100644 --- a/.github/workflows/get_next_scheduled_date.yml +++ b/.github/workflows/calc_next_date.yml @@ -1,26 +1,26 @@ # @usage # -# name: Get next scheduled date +# name: Calc next date # # on: # workflow_dispatch: # # jobs: -# get_next_weekly_scheduled_date: -# uses: route06/actions/.github/workflows/get_next_scheduled_date.yml@v2 +# calc_next_weekly_date: +# uses: route06/actions/.github/workflows/calc_next_date.yml@v2 # with: # interval: weekly # target_day: wednesday # # log_result: # runs-on: ubuntu-latest -# needs: [get_next_weekly_scheduled_date] +# needs: [calc_next_weekly_date] # steps: -# - name: Log the next scheduled date +# - name: Log the calculated next date # run: | -# echo "The next weekly schedule date is: ${{ needs.get_next_weekly_scheduled_date.outputs.next_scheduled_date }}" +# echo "The next weekly date is: ${{ needs.calc_next_weekly_date.outputs.next_date }}" -name: Get next scheduled date +name: Calc next date on: workflow_call: @@ -38,32 +38,32 @@ on: default: "Asia/Tokyo" type: string outputs: - next_scheduled_date: + next_date: description: yyyy/mm/dd形式で日付を返します。 - value: ${{ jobs.get_next_scheduled_date.outputs.next_scheduled_date }} + value: ${{ jobs.calc_next_date.outputs.next_date }} jobs: - get_next_scheduled_date: + calc_next_date: runs-on: ubuntu-latest timeout-minutes: 10 env: TZ: ${{ inputs.time_zone }} steps: - name: Run script - id: get_date + id: calc_date run: | case "${{ inputs.interval }}" in "daily") - next_scheduled_date=$(date -d "tomorrow" +%Y/%m/%d) + next_date=$(date -d "tomorrow" +%Y/%m/%d) ;; "weekly") - next_scheduled_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) + next_date=$(date -d "next ${{ inputs.target_day }}" +%Y/%m/%d) ;; *) echo "Invalid INTERVAL value" exit 1 ;; esac - echo "next_scheduled_date=$next_scheduled_date" >> "$GITHUB_OUTPUT" + echo "next_date=$next_date" >> "$GITHUB_OUTPUT" outputs: - next_scheduled_date: ${{ steps.get_date.outputs.next_scheduled_date }} + next_date: ${{ steps.calc_date.outputs.next_date }} diff --git a/README.md b/README.md index f99652b..5e8b155 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ ROUTE06内外から使われることを想定したGitHub ActionsのReusable Wo 利用可能ですが、最終的なテストやフィードバック待ちのバージョンとなります。 +* [calc_next_date.yml](./.github/workflows/calc_next_date.yml) * [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) -* [get_next_scheduled_date.yml](./.github/workflows/get_next_scheduled_date.yml) ## 開発者向け From 38293a2094c252a80dda5f3a5c8a4089488fb541 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Wed, 31 Jul 2024 12:48:59 +0900 Subject: [PATCH 19/29] Update the usage of create_gh_discussion.yml using calc_next_date.yml --- .github/workflows/create_gh_discussion.yml | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 5a8b114..49b6c59 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -8,31 +8,19 @@ # # 毎週水曜 13:00 JST に実行 # - cron: "0 4 * * wed" # -# env: -# # NOTE: MTG開催曜日に合わせて変更してください -# TARGET_DAY: "wednesday" -# # jobs: # get_next_meeting_date: -# runs-on: ubuntu-latest -# timeout-minutes: 10 -# env: -# TZ: "Asia/Tokyo" -# steps: -# - name: Get next meeting date -# id: get_date -# run: | -# target_date=$(date -d "next $TARGET_DAY" +%Y/%m/%d) -# echo "target_date=$target_date" >> "$GITHUB_OUTPUT" -# outputs: -# target_date: ${{ steps.get_date.outputs.target_date }} +# uses: route06/actions/.github/workflows/calc_next_date.yml@v2 +# with: +# interval: weekly +# target_day: wednesday # NOTE: MTG開催曜日に合わせて変更してください # # create_discussion: # needs: get_next_meeting_date # uses: route06/actions/.github/workflows/create_gh_discussion.yml@v2 # with: # # NOTE: 作成するDiscussionのタイトルを指定 -# title: ${{ needs.get_next_meeting_date.outputs.target_date }} Meeting Title +# title: ${{ needs.calc_next_weekly_date.outputs.next_date }} Meeting Title # # NOTE: discussion_category_slugについては補足参照 # discussion_category_slug: meeting-notes # # NOTE: 作成するDiscussionで使用するテンプレートファイルのパスを指定 From 5226122a90ce39ff1b63693c774ec366480f9e35 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 12:51:10 +0900 Subject: [PATCH 20/29] Use default category_slug for usage --- .github/workflows/create_gh_discussion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 49b6c59..a747b4d 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -22,7 +22,7 @@ # # NOTE: 作成するDiscussionのタイトルを指定 # title: ${{ needs.calc_next_weekly_date.outputs.next_date }} Meeting Title # # NOTE: discussion_category_slugについては補足参照 -# discussion_category_slug: meeting-notes +# discussion_category_slug: ideas # # NOTE: 作成するDiscussionで使用するテンプレートファイルのパスを指定 # description_template_path: _templates/weekly_meeting_discussion/test.md # From b32a1754e6956ba7cd2933d4a15621e730200973 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 12:55:03 +0900 Subject: [PATCH 21/29] Fix usage --- .github/workflows/create_gh_discussion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index a747b4d..83ab095 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -20,7 +20,7 @@ # uses: route06/actions/.github/workflows/create_gh_discussion.yml@v2 # with: # # NOTE: 作成するDiscussionのタイトルを指定 -# title: ${{ needs.calc_next_weekly_date.outputs.next_date }} Meeting Title +# title: ${{ needs.get_next_meeting_date.outputs.next_date }} Meeting Title # # NOTE: discussion_category_slugについては補足参照 # discussion_category_slug: ideas # # NOTE: 作成するDiscussionで使用するテンプレートファイルのパスを指定 From a3422f4abf8d1f1b212d40b5b68f84d0180b3efb Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 12:59:17 +0900 Subject: [PATCH 22/29] Fix YAML indents --- .github/workflows/create_gh_discussion.yml | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 83ab095..8275a2a 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -37,19 +37,19 @@ name: Create discussion on: workflow_call: - inputs: - title: - description: 作成するDiscussionのタイトルを設定してください。 - required: true - type: string - discussion_category_slug: - description: 作成するDiscussionのカテゴリslugを設定してください。 - default: general - type: string - description_template_path: - description: 作成するDiscussionの説明文に利用するテンプレートファイルのパスを設定してください。 - required: true - type: string + inputs: + title: + description: 作成するDiscussionのタイトルを設定してください。 + required: true + type: string + discussion_category_slug: + description: 作成するDiscussionのカテゴリslugを設定してください。 + default: general + type: string + description_template_path: + description: 作成するDiscussionの説明文に利用するテンプレートファイルのパスを設定してください。 + required: true + type: string jobs: create_discussion: From f9f9c95f4cce045fa066218ea2ff6ec26de5e674 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 13:00:31 +0900 Subject: [PATCH 23/29] Remove unnecessary timezone --- .github/workflows/create_gh_discussion.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 8275a2a..3bc8442 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -55,8 +55,6 @@ jobs: create_discussion: runs-on: ubuntu-latest timeout-minutes: 10 - env: - TZ: "Asia/Tokyo" steps: - name: Checkout uses: actions/checkout@v4 From fd8ab1b4b1292442062db4127f25e2698cd01161 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 13:07:42 +0900 Subject: [PATCH 24/29] Remove half-finished JSDoc --- .github/workflows/create_gh_discussion.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 3bc8442..d7e788e 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -70,12 +70,6 @@ jobs: script: | const fs = require("fs"); - /** - * @param {object} github - * @param {string} owner - * @param {string} repositoryName - * @returns - */ async function featchRepoIdAndDiscussionCategoryId(github, owner, repositoryName, discussionCategorySlug) { const result = await github.graphql(`query($owner:String!, $repositoryName:String!, $discussionCategorySlug:String!) { repository(owner: $owner, name: $repositoryName) { From 92a9182d9c363e07357585dcef2927dc189f4946 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 13:07:49 +0900 Subject: [PATCH 25/29] Refactor --- .github/workflows/create_gh_discussion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index d7e788e..6e799f7 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -87,7 +87,7 @@ jobs: return {repositoryId: result.repository.id, categoryId: result.repository.discussionCategory.id}; } - async function createMyDiscussion(github, repositoryId, categoryId, title, description) { + async function createDiscussion(github, repositoryId, categoryId, title, description) { const result = await github.graphql(`mutation($repositoryId:ID!, $categoryId:ID!, $title:String!, $body:String!) { createDiscussion(input: {repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body}) { discussion { @@ -130,7 +130,7 @@ jobs: } })(); - const discussionId = await createMyDiscussion( + const discussionId = await createDiscussion( github, repositoryIdAndCategoryId.repositoryId, repositoryIdAndCategoryId.categoryId, From 76a7daf5da6f54c92a0c690ca4b333a90f4262af Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 13:09:28 +0900 Subject: [PATCH 26/29] Specify what the discussion is about --- .github/workflows/create_gh_discussion.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 6e799f7..b5989e1 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -1,7 +1,7 @@ # todo: 以下はStarter Workflow化する # @usage # -# name: Create discussion +# name: Create GitHub discussion # # on: # schedule: @@ -33,7 +33,7 @@ # カテゴリ `Show and tell` の slug は `show-and-tell`: # https://github.com///discussions/categories/show-and-tell -name: Create discussion +name: Create GitHub discussion on: workflow_call: From e697f832156f7cd0d95ff78b1d18b2e6b6ee9755 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 13:18:49 +0900 Subject: [PATCH 27/29] Remove trailing whitespaces --- .github/workflows/calc_next_date.yml | 2 +- .github/workflows/create_gh_discussion.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/calc_next_date.yml b/.github/workflows/calc_next_date.yml index dd4ec36..654fb6e 100644 --- a/.github/workflows/calc_next_date.yml +++ b/.github/workflows/calc_next_date.yml @@ -24,7 +24,7 @@ name: Calc next date on: workflow_call: - inputs: + inputs: interval: description: daily, weeklyのいずれかを指定してください。 type: string diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index b5989e1..01f3b0f 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -14,7 +14,7 @@ # with: # interval: weekly # target_day: wednesday # NOTE: MTG開催曜日に合わせて変更してください -# +# # create_discussion: # needs: get_next_meeting_date # uses: route06/actions/.github/workflows/create_gh_discussion.yml@v2 @@ -37,7 +37,7 @@ name: Create GitHub discussion on: workflow_call: - inputs: + inputs: title: description: 作成するDiscussionのタイトルを設定してください。 required: true @@ -62,7 +62,7 @@ jobs: - name: Run script env: REPOSITORY: ${{ github.repository }} - DISCUSSION_CATEGORY_SLUG: ${{ inputs.discussion_category_slug }} + DISCUSSION_CATEGORY_SLUG: ${{ inputs.discussion_category_slug }} TITLE: ${{ inputs.title }} DESCRIPTION_TEMPLATE_PATH: ${{ inputs.description_template_path }} uses: actions/github-script@v7 From ebe2e8e56f9109b05d9ab67e3362d0eb1b4f09d3 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Thu, 1 Aug 2024 13:39:43 +0900 Subject: [PATCH 28/29] Align 'category_slug' naming convention with 'title' and 'description_template_path' --- .github/workflows/create_gh_discussion.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create_gh_discussion.yml b/.github/workflows/create_gh_discussion.yml index 01f3b0f..b10781f 100644 --- a/.github/workflows/create_gh_discussion.yml +++ b/.github/workflows/create_gh_discussion.yml @@ -21,13 +21,13 @@ # with: # # NOTE: 作成するDiscussionのタイトルを指定 # title: ${{ needs.get_next_meeting_date.outputs.next_date }} Meeting Title -# # NOTE: discussion_category_slugについては補足参照 -# discussion_category_slug: ideas +# # NOTE: category_slugについては補足参照 +# category_slug: ideas # # NOTE: 作成するDiscussionで使用するテンプレートファイルのパスを指定 # description_template_path: _templates/weekly_meeting_discussion/test.md # # 補足: -# discussion_category_slug は各カテゴリを選択した時の、URL 末尾の文字列です。以下は例です。 +# category_slug は各カテゴリを選択した時の、URL 末尾の文字列です。以下は例です。 # カテゴリ `Q&A` の slug は `q-a`: # https://github.com///discussions/categories/q-a # カテゴリ `Show and tell` の slug は `show-and-tell`: @@ -42,7 +42,7 @@ on: description: 作成するDiscussionのタイトルを設定してください。 required: true type: string - discussion_category_slug: + category_slug: description: 作成するDiscussionのカテゴリslugを設定してください。 default: general type: string @@ -62,7 +62,7 @@ jobs: - name: Run script env: REPOSITORY: ${{ github.repository }} - DISCUSSION_CATEGORY_SLUG: ${{ inputs.discussion_category_slug }} + CATEGORY_SLUG: ${{ inputs.category_slug }} TITLE: ${{ inputs.title }} DESCRIPTION_TEMPLATE_PATH: ${{ inputs.description_template_path }} uses: actions/github-script@v7 @@ -102,14 +102,14 @@ jobs: }); } - const { REPOSITORY, DISCUSSION_CATEGORY_SLUG, TITLE, DESCRIPTION_TEMPLATE_PATH } = process.env; + const { REPOSITORY, CATEGORY_SLUG, TITLE, DESCRIPTION_TEMPLATE_PATH } = process.env; const [owner, repositoryName] = REPOSITORY.split('/'); const repositoryIdAndCategoryId = await featchRepoIdAndDiscussionCategoryId( github, owner, repositoryName, - DISCUSSION_CATEGORY_SLUG, + CATEGORY_SLUG, ) const discussionTitle = TITLE; From 7df6cf7e7d270c6453108f3394976b9f119e5f58 Mon Sep 17 00:00:00 2001 From: tomcky Date: Thu, 1 Aug 2024 16:37:22 +0900 Subject: [PATCH 29/29] update readme. --- README.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5e8b155..5c9fd58 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,13 @@ ROUTE06内外から使われることを想定したGitHub ActionsのReusable Wo * [add_assignee_to_pr.yml](./.github/workflows/add_assignee_to_pr.yml) +* [calc_next_date.yml](./.github/workflows/calc_next_date.yml) * [codeql.yml](./.github/workflows/codeql.yml) +* [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) * [get_last_discussion_url.yml](./.github/workflows/get_last_discussion_url.yml) * [gh_discussion_comment_to_slack.yml](./.github/workflows/gh_discussion_comment_to_slack.yml) * [notify_slack_on_ci_failed.yml](./.github/workflows/notify_slack_on_ci_failed.yml) -### Release Candidate - -利用可能ですが、最終的なテストやフィードバック待ちのバージョンとなります。 - -* [calc_next_date.yml](./.github/workflows/calc_next_date.yml) -* [create_gh_discussion.yml](./.github/workflows/create_gh_discussion.yml) - ## 開発者向け ### ADR