Skip to content

Commit

Permalink
Update publish.yml (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Aug 19, 2024
1 parent b59a86a commit a4ebdd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,16 @@ jobs:
python -m twine upload dist/* -u __token__ -p $PYPI_TOKEN
- name: Extract PR Details
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
PR_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
# Check if the event is a pull request or pull_request_target
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then
PR_NUMBER=${{ github.event.pull_request.number }}
PR_TITLE=$(echo $PR_JSON | jq -r '.title')
PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq '.title')
else
# Use gh to find the PR associated with the commit
COMMIT_SHA=${{ github.event.after }}
PR_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/search/issues?q=repo:${{ github.repository }}+is:pr+is:merged+sha:$COMMIT_SHA")
PR_NUMBER=$(echo $PR_JSON | jq -r '.items[0].number')
PR_TITLE=$(echo $PR_JSON | jq -r '.items[0].title')
PR_JSON=$(gh pr list --search "${COMMIT_SHA}" --state merged --json number,title --jq '.[0]')
PR_NUMBER=$(echo $PR_JSON | jq -r '.number')
PR_TITLE=$(echo $PR_JSON | jq -r '.title')
fi
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion thop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.0.3"
__version__ = "2.0.4"

import torch

Expand Down

0 comments on commit a4ebdd4

Please sign in to comment.