56 lines (47 loc) · 1.61 KB
/
pr-quick-check.yml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Quick check PR
on:
workflow_call:
inputs:
repo:
required: true
type: string
defaults:
run:
shell: bash
env:
PYTHON_VERSION: "3.11"
CHECK_SCRIPT: "ddev/src/ddev/utils/scripts/check_pr.py"
jobs:
check:
name: Check PR
runs-on: ubuntu-22.04
steps:
# Uncomment for testing purposes
# - uses: actions/checkout@v3
# if: inputs.repo == 'core'
# with:
# ref: "${{ github.event.pull_request.head.sha }}"
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Fetch diff
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# https://github.com/cli/cli/blob/v2.33.0/pkg/cmd/pr/diff/diff.go#L167
# https://docs.github.com/en/rest/overview/media-types?apiVersion=2022-11-28#diff-media-type-for-commits-commit-comparison-and-pull-requests
run: >-
curl
--header "Authorization: Bearer $GITHUB_TOKEN"
--header "Accept: application/vnd.github.diff"
-Lo /tmp/diff
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}"
- name: Fetch script
# Uncomment for testing purposes
# if: inputs.repo != 'core'
run: |-
mkdir -p $(dirname ${{ env.CHECK_SCRIPT }})
curl -sLo ${{ env.CHECK_SCRIPT }} https://raw.githubusercontent.com/DataDog/integrations-core/master/${{ env.CHECK_SCRIPT }}
- name: Check
run: |-
python ${{ env.CHECK_SCRIPT }} changelog --diff-file /tmp/diff --pr-file "$GITHUB_EVENT_PATH"