-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (51 loc) · 1.92 KB
/
comparison_workflow.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
57
name: model-comparison-report
on:
issues:
types: [opened, reopened, edited]
permissions:
contents: read
issues: write
jobs:
model-comparison-report:
if: contains(github.event.issue.body, '/wandb')
runs-on: ubuntu-latest
steps:
- name: Get repo contents
uses: actions/checkout@v3
- name: Install dependencies
run: pip install ghapi wandb
- name: Parse value from the command
id: get-runid-value
run: |
echo "${{ github.event.issue.body }}" > issue.txt
match=$(grep -Po '(?<=/wandb\s)\S+' issue.txt || true)
if [[ -n "$match" ]]; then
echo "::set-output name=VAL_FOUND::true"
echo "::set-output name=RUN_ID::$match"
else
echo "::set-output name=VAL_FOUND::false"
fi
- name: Generate the comparison report
if: steps.get-runid-value.outputs.VAL_FOUND == 'true'
id: wandb-report
run: python generate_reports.py
env:
WANDB_ENTITY: ${{ secrets.WANDB_ENTITY }}
WANDB_PROJECT: ${{ secrets.WANDB_PROJECT }}
BASELINE_TAG: ${{ secrets.WANDB_TAG }}
RUN_ID: "${{ steps.get-runid-value.outputs.RUN_ID }}"
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
- name: Make a comment with the GitHub API
uses: actions/github-script@v6
if: steps.wandb-report.outcome == 'success'
with:
script: |
var msg = `Hey! The team will respond to you shortly. We have also created a comparison between the linked run and baseline, and is available [in this report](${process.env.REPORT_URL})`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: msg
});
env:
REPORT_URL: "${{ steps.wandb-report.outputs.REPORT_URL }}"