From 389f48f4d7ee3d6aee4228a954c980bd8d9d5d75 Mon Sep 17 00:00:00 2001 From: Sakamoto Noriaki Date: Mon, 23 Oct 2023 17:01:15 +0900 Subject: [PATCH] Post a welcome comment only when opened (#669) * Remove comment action from pr.yaml * Add pr-comment-welcome.yaml --- .github/workflows/pr-comment-welcome.yaml | 44 +++++++++++++++++++++++ .github/workflows/pr.yaml | 28 --------------- 2 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/pr-comment-welcome.yaml diff --git a/.github/workflows/pr-comment-welcome.yaml b/.github/workflows/pr-comment-welcome.yaml new file mode 100644 index 00000000..32703145 --- /dev/null +++ b/.github/workflows/pr-comment-welcome.yaml @@ -0,0 +1,44 @@ +name: Pull Request Welcome Comment Flow + +on: + pull_request_target: + types: [opened] +# tags-ignore and/or paths does not work with pull_request_target +# tags-ignore: +# - "automated pr" +# paths: +# - "packages/**" + +jobs: + welcome: + name: Welcome comment + runs-on: ubuntu-latest + steps: + + - name: comment PR + uses: actions/github-script@v2 + env: + HEAD_BRANCH: ${{ github.head_ref }} + GITHUB_ACTOR: ${{ github.actor }} + with: + github-token: ${{ github.token }} + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: ` + 🎉🎉🎉 Thank you for sending a PR! + + If this PR is to add new or updated SATySFi libraries, I would like you to include your new library in the package snapshots, by following the instructions below. + + After the CI passes, choose “automatic follow-up” options to add your libraries to add snapshots. + Please leave a comment in case you don't want. + + **Notes:** I recommend adding your libraries to the snapshot with the latest develop version as well + if your library supports the latest stable version, + because the snapshot with the latest develop version will be the snapshot with the the comming SATySFi stable version. + + Thanks! + ` + }) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index a973c2db..65860159 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -54,31 +54,3 @@ jobs: ...pullRequestId, body: replacedBody }); - - - name: comment PR - uses: actions/github-script@v2 - env: - HEAD_BRANCH: ${{ github.head_ref }} - GITHUB_ACTOR: ${{ github.actor }} - with: - github-token: ${{ github.token }} - script: | - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: ` - 🎉🎉🎉 Thank you for sending a PR! - - If this PR is to add new or updated SATySFi libraries, I would like you to include your new library in the package snapshots, by following the instructions below. - - After the CI passes, choose “automatic follow-up” options to add your libraries to add snapshots. - Please leave a comment in case you don't want. - - **Notes:** I recommend adding your libraries to the snapshot with the latest develop version as well - if your library supports the latest stable version, - because the snapshot with the latest develop version will be the snapshot with the the comming SATySFi stable version. - - Thanks! - ` - })