Feature/ci metrics #102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Repo Check | |
on: | |
#workflow_run: | |
# workflows: ["Pull Request Tests"] | |
# types: | |
# - requested | |
pull_request: | |
branches: | |
- develop | |
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-20.04 | |
steps: | |
- name: Share helper id | |
run: echo -n ${{ github.run_id }} >~/id_file | |
- uses: actions/cache@v4 | |
with: | |
path: ~/id_file | |
key: helperid-${{ github.event.workflow_run.id }} | |
repocheck: | |
name: Repo check | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check up-to-dateness and post comment | |
run: | | |
trap 'echo "exit-code=$?" >> "$GITHUB_OUTPUT"' EXIT | |
head_sha=${{ github.event.pull_request.head.sha }} | |
head_brc=${{ github.event.pull_request.head.ref }} | |
head_url=${{ github.event.pull_request.head.repo.html_url }} | |
git clone -q -b $head_brc $head_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.pull_request.head.repo.owner.login }} | |
echo "pr_uid is $pr_uid" | |
./repo_check.sh | |
#comment="$(./repo_check.sh 2>/dev/null)" | |
#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 |