-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (49 loc) · 1.67 KB
/
docker-image.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
name: Helpers-test
on:
#workflow_run:
# workflows: ["Pull Request Tests"]
# types:
# - requested
pull_request:
branches: [ "main" ]
env:
app: Accept:application/vnd.github.v3+json
base_url: $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/runs
AUTH: ${{ secrets.GITHUB_TOKEN }}
jobs:
pre:
name: Preprocess
runs-on: ubuntu-latest
steps:
- name: Share helper id
run: echo -n ${{ github.run_id }} >~/id_file
- uses: actions/cache@v2
with:
path: ~/id_file
key: helperid-${{ github.event.workflow_run.id }}
repocheck:
name: Repo check
runs-on: ubuntu-latest
steps:
- name: Check up-to-dateness and post comment
run: |
head_sha=${{ github.event.workflow_run.head_sha }}
git clone -q ${{ github.event.workflow_run.head_repository.html_url }} .
git checkout -q $head_sha
git submodule -q update --init --recursive
cd ${{ github.workspace }}/tests/ci
url=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY
pr_number=$(curl -sS -H $app $url/pulls \
| jq -r '.[] | select(.head.sha == "'"$head_sha"'") | .number')
echo "pr_number is $pr_number"
pr_uid=${{ github.event.workflow_run.head_repository.owner.login }}
echo "pr_uid is $pr_uid"
comment="$(./repo_check.sh $pr_uid)"
echo "comment is $comment"
if [[ -n $comment ]]; then
curl -sS -X POST -H $app -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
$url/issues/$pr_number/comments -d '{"body": "'"${comment}"'"}'
echo -n "failure" >~/repocheck_file
else
echo -n "success" >~/repocheck_file
fi