Test new hgf format #49
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: PR Contains | |
on: | |
pull_request_target: | |
branches: [main] | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
template: ${{ steps.step1.outputs.template }} | |
commentid: ${{ steps.step1.outputs.commentid }} | |
iserror: ${{ steps.step1.outputs.iserror }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
cache: 'pip' | |
- run: pip install -r ./scripts/requirements.txt | |
- name: Run PR Contains | |
id: step1 | |
run: | | |
python -u ./scripts/pr_contains.py | |
find-issues: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: ${{needs.build.outputs.commentid}} | |
message: | | |
${{needs.build.outputs.template}} | |
- name: Check if error | |
if: ${{needs.build.outputs.iserror == 'true'}} | |
run: exit 1 | |
add-reviewer: | |
needs: find-issues | |
runs-on: ubuntu-latest | |
steps: | |
- uses: kentaro-m/[email protected] | |
labelError: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkerror | |
# if the build job fails, add the error label | |
if: ${{needs.build.outputs.iserror == 'true'}} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: ${{ env.PR_NUMBER }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['error'] | |
}) | |
- name: interrupt | |
if: ${{needs.build.outputs.iserror == 'true'}} | |
run: exit 1 | |
label: | |
needs: labelError | |
permissions: | |
contents: read | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- id: labelPR | |
uses: actions/labeler@v5 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
configuration-path: .github/labeler.yml | |
dot: false | |
sync-labels: true | |
# - id: echo-labels | |
# run: | | |
# echo "${{ steps.labeler.outputs.all-labels }}" | |
# echo "${{ steps.labeler.outputs.new-labels }}" |