|
9 | 9 | rebuild:
|
10 | 10 | name: Rebuild Action
|
11 | 11 | runs-on: ubuntu-latest
|
12 |
| - if: github.event.label.name == 'Rebuild' |
| 12 | + if: github.event.label.name == 'Rebuild' || github.event_name == 'workflow_dispatch' |
13 | 13 |
|
14 | 14 | permissions:
|
15 | 15 | contents: write # needed to push rebuilt commit
|
|
18 | 18 | - name: Checkout
|
19 | 19 | uses: actions/checkout@v4
|
20 | 20 | with:
|
21 |
| - ref: ${{ github.event.pull_request.head.ref }} |
| 21 | + ref: ${{ github.event.pull_request.head.ref || github.event.ref }} |
22 | 22 |
|
23 | 23 | - name: Remove label
|
| 24 | + if: github.event_name == 'pull_request' |
24 | 25 | env:
|
25 | 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
26 | 27 | PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
30 | 31 |
|
31 | 32 | - name: Merge in changes from base branch
|
32 | 33 | env:
|
33 |
| - BASE_BRANCH: ${{ github.event.pull_request.base.ref }} |
| 34 | + BASE_BRANCH: ${{ github.event.pull_request.base.ref || 'main' }} |
34 | 35 | run: |
|
35 | 36 | git fetch origin "$BASE_BRANCH"
|
36 | 37 |
|
|
64 | 65 | python3 sync.py
|
65 | 66 |
|
66 | 67 | - name: Check for changes and push
|
| 68 | + id: push |
67 | 69 | env:
|
68 |
| - BRANCH: ${{ github.event.pull_request.head.ref }} |
| 70 | + BRANCH: ${{ github.event.pull_request.head.ref || github.event.ref }} |
69 | 71 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
70 | 72 | PR_NUMBER: ${{ github.event.pull_request.number }}
|
71 | 73 | run: |
|
|
75 | 77 | git add --all
|
76 | 78 | git commit -m "Rebuild"
|
77 | 79 | git push origin "HEAD:$BRANCH"
|
78 |
| - echo "Pushed a commit to rebuild the Action." \ |
79 |
| - "Please mark the PR as ready for review to trigger PR checks." | |
80 |
| - gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER" |
81 |
| - gh pr ready --undo --repo github/codeql-action "$PR_NUMBER" |
| 80 | + echo "::set-output name=changes::true" |
82 | 81 | fi
|
| 82 | +
|
| 83 | + - name: Notify about rebuild |
| 84 | + if: github.event_name == 'pull_request' && steps.push.outputs.changes == 'true' |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 88 | + run: | |
| 89 | + echo "Pushed a commit to rebuild the Action." \ |
| 90 | + "Please mark the PR as ready for review to trigger PR checks." | |
| 91 | + gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER" |
| 92 | + gh pr ready --undo --repo github/codeql-action "$PR_NUMBER" |
0 commit comments