Skip to content

[GitHub] Fix action using github.context #1

[GitHub] Fix action using github.context

[GitHub] Fix action using github.context #1

name: Post - Github activity (PRs)
on:
pull_request:
types:
- opened
- synchronize
- review_requested
- closed
- labeled
jobs:
run:
runs-on: ubuntu-latest
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)
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.author.login}}\nLabels: ${{github.event.pull_request.labels.name}}"
# PR merged
- name: Run script post-discord-message.py for PR merged
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.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}} for merging PR [#${{github.event.pull_request.number}}](https://github.com/sofa-framework/sofa/pull/${{github.event.pull_request.number}}) ${{github.event.pull_request.title}} (author: @${{github.event.pull_request.author.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_name == 'pull_request') && (github.event.pull_request.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: ${{github.event.pull_request.requested_reviewers}} 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: ""