add XORAI, XORAI Website #529
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: Review Labels (trigger) | |
| # This workflow only DETECTS what label change is needed and hands it off | |
| # to the "Review Labels (apply)" workflow via an artifact. It does NOT | |
| # write labels itself, because the pull_request_review event runs with a | |
| # read-only token for PRs from forks. The apply workflow runs on | |
| # workflow_run, which always has a writable token in the base-repo context. | |
| on: | |
| pull_request_review: | |
| types: [submitted] | |
| pull_request_target: | |
| branches: | |
| - master | |
| types: [synchronize] | |
| jobs: | |
| detect: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Determine action | |
| id: detect | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| pr_number="" | |
| action="" | |
| if [ "${{ github.event_name }}" = "pull_request_review" ]; then | |
| if [ "${{ github.event.review.state }}" = "changes_requested" ]; then | |
| pr_number="${{ github.event.pull_request.number }}" | |
| action="changes_requested" | |
| fi | |
| elif [ "${{ github.event_name }}" = "pull_request_target" ]; then | |
| # Skip "Update branch" merge commits (base branch merged into PR). | |
| # These have two parents where the second parent is the base branch | |
| # tip -- they represent no new author work, so labels should not swap. | |
| head_sha="${{ github.event.pull_request.head.sha }}" | |
| repo="${{ github.repository }}" | |
| parent_count=$(gh api "repos/$repo/commits/$head_sha" \ | |
| --jq '.parents | length') | |
| if [ "$parent_count" -ge 2 ]; then | |
| second_parent=$(gh api "repos/$repo/commits/$head_sha" \ | |
| --jq '.parents[1].sha') | |
| base_sha=$(gh api "repos/$repo/git/refs/heads/master" \ | |
| --jq '.object.sha') | |
| if [ "$second_parent" = "$base_sha" ]; then | |
| echo "Head commit is an \"Update branch\" merge; skipping." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| fi | |
| pr_number="${{ github.event.pull_request.number }}" | |
| action="new_commits" | |
| fi | |
| if [ -z "$action" ]; then | |
| echo "No relevant action; skipping." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| mkdir -p ./label-task | |
| { | |
| echo "pr_number=$pr_number" | |
| echo "action=$action" | |
| } > ./label-task/task.txt | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| - name: Upload task artifact | |
| if: steps.detect.outputs.skip == 'false' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: label-task | |
| path: ./label-task/ | |
| retention-days: 1 |