Skip to content

Zach1221 Update repo_check.sh #31

Zach1221 Update repo_check.sh

Zach1221 Update repo_check.sh #31

Workflow file for this run

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-20.04
steps:
- name: Check up-to-dateness and post comment
run: |
echo $helperid
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"
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