forked from 2i2c-org/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (39 loc) · 1.74 KB
/
comment-deployment-plan-pr.yaml
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
name: Comment Hub Deployment Plan to a Pull Request
on:
workflow_run:
workflows:
- "Deploy and test hubs"
types:
- "completed"
jobs:
# This job downloads artifacts generated by the "Deploy and test hubs" workflow.
# The artifacts generated are two files: one containing the Pull Request number of the
# run, and a second containing Markdown tables detailing which hubs will be upgraded as
# a result of merging a Pull Request. This Markdown content will be posted to the
# Pull Request as a comment. This means that no-one has to go searching through
# GitHub Actions logs to see if the hubs they intended to be upgraded, will be
# upgraded. The job posts the comment in a 'Netlify style', i.e., if a comment has
# already been posted (identified as having the 'github-actions[bot]' author and
# '<!-- deployment-plan -->' string in the body), the existing comment will be
# updated rather than posting a new one.
post-deployment-plan:
runs-on: ubuntu-latest
# Only run this job if the workflow that triggered it was from a Pull Request and
# completed successfully
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
# Give GITHUB_TOKEN enough permissions to read actions artifacts, issue comments and
# post/update comments on Pull Requests
permissions:
actions: read
issues: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- run: pip install requests
- run: python extra-scripts/comment-deployment-plan-pr.py
env:
GITHUB_REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.event.workflow_run.id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}