Skip to content

Commit 58f225f

Browse files
committed
Allow cleaning pr check from github actions
Similar to the alidist one, but with AliceO2 defaults.
1 parent 8f20905 commit 58f225f

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Clean PR checks
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pr:
6+
description: PR to be cleaned
7+
required: true
8+
checks:
9+
description: Checks to be cleaned
10+
required: true
11+
default: 'build/AliceO2/O2/o2/macOS,build/O2/fullCI,build/O2/o2'
12+
owner:
13+
description: Organization
14+
required: true
15+
default: 'AliceO2Group'
16+
repo:
17+
description: Repository
18+
required: true
19+
default: 'AliceO2'
20+
jobs:
21+
cleanup_pr_checks:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Set up Python 3.7
25+
uses: actions/setup-python@v1
26+
with:
27+
python-version: 3.7
28+
- name: Install ali-bot
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
32+
python -m pip install --upgrade pip
33+
pip install git+https://github.com/alisw/ali-bot@master
34+
- uses: octokit/graphql-action@v2.x
35+
id: get_last_commit_for_pr
36+
with:
37+
query: |
38+
{
39+
repository(owner: "${{ github.event.inputs.owner }}", name: "${{ github.event.inputs.repo }}") {
40+
url
41+
pullRequest(number:${{ github.event.inputs.pr }}) {
42+
commits(last: 1) {
43+
nodes {
44+
commit {
45+
oid
46+
}
47+
}
48+
}
49+
}
50+
}
51+
}
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
- name: Cleanup tests
55+
run: |-
56+
set -x
57+
cat <<\EOF > results.json
58+
${{ steps.get_last_commit_for_pr.outputs.data }}
59+
EOF
60+
COMMIT=$(jq -r '.repository.pullRequest.commits.nodes[].commit.oid' results.json)
61+
echo $COMMIT
62+
for check in `echo ${{ github.event.inputs.checks }} | tr , \\\\n`; do
63+
set-github-status -c ${{ github.event.inputs.owner }}/${{ github.event.inputs.repo }}@$COMMIT -s $check/pending
64+
done
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)