Skip to content

Commit

Permalink
Use GITHUB_TOKEN to validate commits
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
mdellweg committed Aug 19, 2021
1 parent a0c1e84 commit e259fe9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .ci/scripts/validate_commit_message.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import subprocess
import sys
Expand All @@ -13,7 +14,7 @@
project = "pulp-cli"
message = subprocess.check_output(["git", "log", "--format=%B", "-n 1", sha]).decode("utf-8")

g = Github()
g = Github(os.environ.get("GITHUB_TOKEN"))
repo = g.get_repo("pulp/pulp-cli")


Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ jobs:
pip install -r test_requirements.txt
- name: Check commit message
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_CONTEXT: ${{ github.event.pull_request.commits_url }}
run: |
for sha in $(curl $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g')
for sha in $(curl -H "Authorization: token $GITHUB_TOKEN" $GITHUB_CONTEXT | jq '.[].sha' | sed 's/"//g')
do
python .ci/scripts/validate_commit_message.py $sha
VALUE=$?
Expand Down

0 comments on commit e259fe9

Please sign in to comment.