Skip to content

Commit a4ebdd4

Browse files
authored
Update publish.yml (#49)
1 parent b59a86a commit a4ebdd4

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,16 @@ jobs:
173173
python -m twine upload dist/* -u __token__ -p $PYPI_TOKEN
174174
- name: Extract PR Details
175175
run: |
176-
if [ "${{ github.event_name }}" = "pull_request" ]; then
177-
PR_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
176+
# Check if the event is a pull request or pull_request_target
177+
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then
178178
PR_NUMBER=${{ github.event.pull_request.number }}
179-
PR_TITLE=$(echo $PR_JSON | jq -r '.title')
179+
PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq '.title')
180180
else
181+
# Use gh to find the PR associated with the commit
181182
COMMIT_SHA=${{ github.event.after }}
182-
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")
183-
PR_NUMBER=$(echo $PR_JSON | jq -r '.items[0].number')
184-
PR_TITLE=$(echo $PR_JSON | jq -r '.items[0].title')
183+
PR_JSON=$(gh pr list --search "${COMMIT_SHA}" --state merged --json number,title --jq '.[0]')
184+
PR_NUMBER=$(echo $PR_JSON | jq -r '.number')
185+
PR_TITLE=$(echo $PR_JSON | jq -r '.title')
185186
fi
186187
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
187188
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV

thop/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.0.3"
1+
__version__ = "2.0.4"
22

33
import torch
44

0 commit comments

Comments
 (0)