Edit: IRINN Logo #12647
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: Validate Label | |
| on: | |
| issues: | |
| types: [labeled] | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository code | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 | |
| - uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2 | |
| if: ${{ !env.ACT }} | |
| id: create-app-token | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Block self-approval | |
| if: | | |
| github.event.label.name == 'approved' && | |
| github.actor == github.event.issue.user.login | |
| env: | |
| GH_TOKEN: ${{ steps.create-app-token.outputs.token }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| run: | | |
| if [ "${{ env.ACT }}" = "true" ]; then | |
| echo "[MOCK] Post comment: A request cannot be approved by its author." | |
| echo "[MOCK] Remove label: approved" | |
| else | |
| gh issue comment $ISSUE_NUMBER --body "A request cannot be approved by its author." | |
| gh issue edit $ISSUE_NUMBER --remove-label "approved" | |
| fi | |
| exit 1 |