Skip to content

Updated the affiliation from NTU to ZJU #4041

Updated the affiliation from NTU to ZJU

Updated the affiliation from NTU to ZJU #4041

name: Commit Validation
on:
pull_request:
permissions:
contents: read
issues: write
pull-requests: write
# needed for github actions
repository-projects: read
jobs:
commit_validation:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: jitterbit/get-changed-files@v1
id: abc
with:
format: space-delimited
token: ${{ secrets.GITHUB_TOKEN }}
# Checkout the repo
- uses: actions/checkout@v3
with:
fetch-depth: 0 # needed to checkout all branches for this Action to work
# Check the PR diff using the current branch and the base branch of the PR
- uses: GrantBirki/[email protected]
id: git-diff-action
with:
json_diff_file_output: diff.json
raw_diff_file_output: diff.txt
# Print the diff in JSON format
- name: Check commits for validity
id: validation
env:
DIFF: ${{ steps.git-diff-action.outputs.json-diff-path }}
run: |
pip install -r requirements.txt
python validate_commit.py $DIFF
- name: Make comment and mark stale if failed
if: failure()
run: |
echo "Mark as stale"
gh pr edit "$PR_NUMBER" --add-label stale
gh pr comment "$PR_NUMBER" --body 'The validity checks failed. Please look at the logs (click the red X) and correct the errors. Your PR will be closed automatically in 2 days if not fixed.'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: Mark unstale if success
if: success()
run: |
if gh pr view "$PR_NUMBER" --json labels | grep stale ; then
echo "No longer stale"
gh pr edit "$PR_NUMBER" --remove-label stale
gh pr comment "$PR_NUMBER" --body 'The validity checks are now passing. Thank you.'
else
echo "Was already not stale"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}