generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 7
57 lines (56 loc) · 1.95 KB
/
post_corpus_stats.yml
File metadata and controls
57 lines (56 loc) · 1.95 KB
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
57
name: Post corpus statistics on a pull request
permissions:
contents: read
pull-requests: write
actions: read
statuses: read
on:
# Note: Workflows triggered via pull_request_target have write permission to the
# target repository and access to target repository secrets.
# Therefore, any changes to this workflow must not run untrusted code.
pull_request_target:
paths:
- "corpus-tests.tar.gz"
jobs:
post_stats:
name: Post corpus statistics
runs-on: ubuntu-latest
steps:
- name: Checkout the latest commit for the BASE branch
uses: actions/checkout@v4
with:
path: cedar-integration-tests
ref: ${{ github.event.pull_request.base.sha }}
- name: Download the corpus for the HEAD
uses: actions/checkout@v4
with:
sparse-checkout: corpus-tests.tar.gz
sparse-checkout-cone-mode: false
path: new-corpus
# NOTE: Do NOT run code from the head in this workflow
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
- name: Configure the virtual environment
working-directory: cedar-integration-tests
shell: bash
run: |
python3 -m venv venv
. venv/bin/activate
pip install -r ./scripts/requirements.txt
- name: Compute corpus statistics
working-directory: cedar-integration-tests
shell: bash
run: |
. venv/bin/activate
python3 ./scripts/get_corpus_stats.py ../new-corpus/corpus-tests.tar.gz --original corpus-tests.tar.gz --report-file comment.md
- name: Post comment
working-directory: cedar-integration-tests
shell: bash
run: gh pr comment $PR_NUMBER --body-file comment.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}