chore(deps): bump gradle/actions from 5.0.2 to 6.0.1 #158
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: PR - Request report labels | |
| # Warning, this job is running on pull_request_target and therefore has access to issue content. | |
| # Don't add any steps that act on external code. | |
| on: | |
| pull_request_target: | |
| types: [ opened, reopened, synchronize, labeled, unlabeled ] | |
| branches: | |
| - main | |
| - beta | |
| - release | |
| permissions: | |
| contents: none | |
| jobs: | |
| require-report-label: | |
| permissions: | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate report label | |
| id: validate | |
| run: | | |
| set -euo pipefail | |
| labels_json='${{ toJson(github.event.pull_request.labels) }}' | |
| echo "Current labels:" | |
| echo "$labels_json" | jq -r '.[].name' | |
| include_count="$(jq '[.[] | select(.name == "report: include")] | length' <<< "$labels_json")" | |
| exclude_count="$(jq '[.[] | select(.name == "report: exclude")] | length' <<< "$labels_json")" | |
| highlight_count="$(jq '[.[] | select(.name == "report: highlight")] | length' <<< "$labels_json")" | |
| total_count=$((include_count + exclude_count + highlight_count)) | |
| if [ "$total_count" -eq 0 ]; then | |
| echo "valid=false" >> "$GITHUB_OUTPUT" | |
| echo "message=Missing report label. Set exactly one of: \`report: include\`, \`report: exclude\` OR \`report: highlight\`." >> "$GITHUB_OUTPUT" | |
| elif [ "$total_count" -gt 1 ]; then | |
| echo "valid=false" >> "$GITHUB_OUTPUT" | |
| echo "message=Only one report label is allowed: \`report: include\`, \`report: exclude\` OR \`report: highlight\`." >> "$GITHUB_OUTPUT" | |
| else | |
| echo "valid=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Comment on PR (only on error) | |
| if: steps.validate.outputs.valid == 'false' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| MESSAGE: ${{ steps.validate.outputs.message }} | |
| run: | | |
| gh pr comment "$PR_NUMBER" \ | |
| --repo "${{ github.repository }}" \ | |
| --body "$MESSAGE" | |
| - name: Fail if invalid | |
| if: steps.validate.outputs.valid == 'false' | |
| env: | |
| MESSAGE: ${{ steps.validate.outputs.message }} | |
| run: | | |
| echo "::error::$MESSAGE" | |
| exit 1 |