-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GitHub] Fix action using github.context (#4456)
* [GitHub] Fix action using github.context * use the post-discord-message.py script to avoid msg embeds * change github.context.payload.pull_request.action * test bot name using context * test message * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * fix all variable uses * fix wrong merge * fix use of removed function * fix pending-discussion * test empty embeds * last test in embeds * propagate the use of github.event * forgotten github.event to propagate * if using multiple conditions * Test list of events instead of array * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * Update post-github-activity.yml * fix no embeds, now working! * minor cosmetic * split action for GH activities in three different files * rename created actions * simplify action conditions * fix use of user.login, fix PR trigger and cosmetic * fix cases where no embeds is given * fix python if * add stargazer name mention * test new if condition in action * update all if condition in the same way * attempt to fix if condition * update message reviewers * it works : good condition for if condition * fix message for thanking reviewers * use * for arrays * reformat message * use to join function * apply a if condition to all actions to apply ONLY on sofa-framework * Apply suggestions from code review * Update .github/workflows/post-release.yml Co-authored-by: Paul Baksic <[email protected]> --------- Co-authored-by: Paul Baksic <[email protected]>
- Loading branch information
Showing
14 changed files
with
185 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Post - Github activity (issues) | ||
|
||
on: | ||
issues: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'sofa-framework' }} | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install python-graphql-client | ||
pip install python-dateutil | ||
pip install requests | ||
working-directory: ${{ github.workspace }} | ||
|
||
# Issue related event | ||
- name: Run script post-discord-message.py for Issue opened | ||
run: | | ||
python scripts/discord/post-discord-message.py | ||
working-directory: ${{ github.workspace }} | ||
env: | ||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_MAIN_WEBHOOK_URL }} | ||
MESSAGE: ":space_invader: New issue raised \"[${{github.event.issue.title}}](https://github.com/sofa-framework/sofa/issues/${{github.event.issue.number}})\" by [@${{github.event.issue.user.login}}](https://github.com/${{github.event.issue.user.login}})" | ||
BOT_NAME: "SOFA Github bot" | ||
EMBEDS_TITLE: "${{github.event.issue.title}} (#${{github.event.issue.number}})" | ||
EMBEDS_URL: "https://github.com/sofa-framework/sofa/issues/${{github.event.issue.number}}" | ||
EMBEDS_DESCRIPTION: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Post - Github activity (PRs) | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- review_requested | ||
- closed | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'sofa-framework' }} | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install python-graphql-client | ||
pip install python-dateutil | ||
pip install requests | ||
working-directory: ${{ github.workspace }} | ||
|
||
# PR opened | ||
- name: Run script post-discord-message.py for PR opened (main) | ||
if: ${{ github.event.action == 'opened' }} | ||
run: | | ||
python scripts/discord/post-discord-message.py | ||
working-directory: ${{ github.workspace }} | ||
env: | ||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_MAIN_WEBHOOK_URL }} | ||
MESSAGE: ":new: PR opened: [#${{github.event.pull_request.number}} ${{github.event.pull_request.title}}](https://github.com/sofa-framework/sofa/pull/${{github.event.pull_request.number}})" | ||
BOT_NAME: "SOFA Github bot" | ||
EMBEDS_TITLE: "#${{github.event.pull_request.number}} ${{github.event.pull_request.title}}" | ||
EMBEDS_URL: "https://github.com/sofa-framework/sofa/pull/${{github.event.pull_request.number}}" | ||
EMBEDS_DESCRIPTION: "Authored by @${{github.event.pull_request.user.login}}\nLabels: ${{ join(github.event.pull_request.labels.*.name, ', ') }}" | ||
|
||
# PR merged | ||
- name: Run script post-discord-message.py for PR merged | ||
if: ${{ github.event.action == 'closed' && github.event.pull_request.merged == true }} | ||
run: | | ||
python scripts/discord/post-discord-message.py | ||
working-directory: ${{ github.workspace }} | ||
env: | ||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_MAIN_WEBHOOK_URL }} | ||
MESSAGE: ":raised_hands: Thanks [@${{github.event.pull_request.merged_by.login}}](https://github.com/${{github.event.pull_request.merged_by.login}}) for merging PR [#${{github.event.pull_request.number}} ${{github.event.pull_request.title}}](https://github.com/sofa-framework/sofa/pull/${{github.event.pull_request.number}}) authored by @${{github.event.pull_request.user.login}}" | ||
BOT_NAME: "SOFA Github bot" | ||
EMBEDS_TITLE: "" | ||
EMBEDS_URL: "" | ||
EMBEDS_DESCRIPTION: "" | ||
|
||
# PR review requested event | ||
- name: Run script post-discord-message.py for PR review request | ||
if: ${{ github.event.action == 'review_requested' }} | ||
run: | | ||
python scripts/discord/post-discord-message.py | ||
working-directory: ${{ github.workspace }} | ||
env: | ||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_MAIN_WEBHOOK_URL }} | ||
MESSAGE: ":eyeglasses: Review requested: join(github.event.pull_request.requested_reviewers.*.login, ', ') would you please review [#${{github.event.pull_request.number}}](https://github.com/sofa-framework/sofa/pull/${{github.event.pull_request.number}})?" | ||
BOT_NAME: "SOFA Github bot" | ||
EMBEDS_TITLE: "" | ||
EMBEDS_URL: "" | ||
EMBEDS_DESCRIPTION: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Post - Github activity (stars) | ||
|
||
on: | ||
watch: | ||
types: [started] | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'sofa-framework' }} | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install python-graphql-client | ||
pip install python-dateutil | ||
pip install requests | ||
working-directory: ${{ github.workspace }} | ||
|
||
# Star/watch related event | ||
- name: Run script post-discord-message.py for stars | ||
run: | | ||
python scripts/discord/post-discord-message.py | ||
working-directory: ${{ github.workspace }} | ||
env: | ||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_MAIN_WEBHOOK_URL }} | ||
MESSAGE: ":fire: :fire: Come ON :fire: :fire: \nOne new :star: for SOFA on Github!" | ||
BOT_NAME: "SOFA Github bot" | ||
EMBEDS_TITLE: "" | ||
EMBEDS_URL: "" | ||
EMBEDS_DESCRIPTION: "" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.