[Ramses] Change types in Drag integrator to Tscal #712
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: trigger-ci-empty-commit | |
| on: | |
| pull_request_target: | |
| types: [labeled] | |
| concurrency: | |
| group: trigger-ci-${{ github.event.pull_request.number }} | |
| cancel-in-progress: false | |
| jobs: | |
| trigger_ci: | |
| name: Trigger CI with empty commit | |
| if: ${{ github.event.label.name == 'trigger-ci' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| steps: | |
| - name: Remove label trigger-ci | |
| uses: actions-ecosystem/action-remove-labels@v1 | |
| with: | |
| labels: trigger-ci | |
| github_token: ${{ secrets.GHACTION_PAT }} | |
| - name: Determine if we can push to the PR branch | |
| id: can_push | |
| run: | | |
| IS_FORK="${{ github.event.pull_request.head.repo.full_name != github.repository }}" | |
| MAINTAINER_CAN_MODIFY="${{ github.event.pull_request.maintainer_can_modify }}" | |
| if [ "$IS_FORK" = "true" ] && [ "$MAINTAINER_CAN_MODIFY" != "true" ]; then | |
| echo "can_push=false" >> "$GITHUB_OUTPUT" | |
| echo "Cannot push: PR is from a fork and 'Allow edits from maintainers' is disabled." | |
| exit 0 | |
| fi | |
| echo "can_push=true" >> "$GITHUB_OUTPUT" | |
| - name: Checkout PR branch | |
| if: steps.can_push.outputs.can_push == 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ secrets.GHACTION_PAT }} | |
| - name: Create and push empty commit | |
| if: steps.can_push.outputs.can_push == 'true' | |
| env: | |
| HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
| HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} | |
| run: | | |
| git config --global --add safe.directory '*' | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit --allow-empty -m "[gh-action] trigger CI with empty commit" | |
| git push origin "HEAD:${HEAD_REF}" | |
| - name: Explain why we could not push (fork PRs without maintainer edits) | |
| if: steps.can_push.outputs.can_push != 'true' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const issue_number = context.payload.pull_request.number; | |
| const msg = [ | |
| "I can't push the empty commit to this PR branch because it comes from a fork and **'Allow edits from maintainers'** is disabled.", | |
| "", | |
| "To trigger CI, either:", | |
| "- enable **Allow edits from maintainers** on the PR, then re-add the `trigger-ci` label, or", | |
| "- push an empty commit yourself with message `[gh-action] trigger CI with empty commit`." | |
| ].join("\n"); | |
| await github.rest.issues.createComment({ owner, repo, issue_number, body: msg }); |