@@ -2,8 +2,6 @@ name: Calculate Docker Image Size
22
33on :
44 workflow_dispatch :
5- issue_comment :
6- types : [created]
75
86permissions :
97 contents : read
1513 PYTHON_VERSION : ' 3.13'
1614 TASKFILE_VERSION : ' v3.44.0'
1715 TASKFILE_PATH : ' /home/runner/go/bin'
18- if : |
19- github.event_name == 'workflow_dispatch' ||
20- (github.event_name == 'issue_comment' && github.event.comment.body == '/calculate-size' && github.event.issue.pull_request)
2116
2217 services :
2318 registry :
@@ -34,16 +29,11 @@ jobs:
3429 env :
3530 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3631 run : |
37- if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
38- echo "Searching for PR from branch '${{ github.ref_name }}'..."
39- PR_NUMBER=$(gh pr list --state open --head "${{ github.ref_name }}" --json number --jq '.[0].number // empty')
40- if [ -z "$PR_NUMBER" ]; then
41- echo "Not found in current repo, searching across forks..."
42- PR_NUMBER=$(gh pr list --state open --json number,headRefName,headRepositoryOwner --jq ".[] | select(.headRefName == \"${{ github.ref_name }}\") | .number" | head -n1)
43- fi
44- else
45- # For issue_comment, the PR number is in the event context
46- PR_NUMBER=${{ github.event.issue.number }}
32+ echo "Searching for PR from branch '${{ github.ref_name }}'..."
33+ PR_NUMBER=$(gh pr list --state open --head "${{ github.ref_name }}" --json number --jq '.[0].number // empty')
34+ if [ -z "$PR_NUMBER" ]; then
35+ echo "Not found in current repo, searching across forks..."
36+ PR_NUMBER=$(gh pr list --state open --json number,headRefName,headRepositoryOwner --jq ".[] | select(.headRefName == \"${{ github.ref_name }}\") | .number" | head -n1)
4737 fi
4838
4939 if [ -z "$PR_NUMBER" ]; then
5343 fi
5444 echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
5545
56- - name : Checkout PR Branch (for comment trigger)
57- if : github.event_name == 'issue_comment'
58- env :
59- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60- run : |
61- gh pr checkout ${{ steps.pr_info.outputs.pr_number }}
62-
6346 - name : Set up Python
6447 uses : actions/setup-python@v5
6548 with :
0 commit comments