feat(frontend): Utils to check dismissed notifications #74243
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: 'PR Checks' | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - edited | |
| - reopened | |
| - synchronize | |
| - labeled | |
| merge_group: | |
| permissions: {} | |
| jobs: | |
| check-pr-title: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| pull-requests: read | |
| env: | |
| TITLE: ${{ github.event.pull_request.title }} | |
| steps: | |
| - name: 'Check PR Title' | |
| if: ${{ github.event_name != 'merge_group' }} | |
| run: | | |
| if [[ "$TITLE" =~ ^(feat|fix|chore|build|ci|docs|style|refactor|perf|test)(\([-a-zA-Z0-9,]+\))\!?\: ]]; then | |
| echo "PR Title passes" | |
| else | |
| echo "PR Title does not match conventions:" | |
| echo " verb(scope): description" | |
| echo "or for a breaking change:" | |
| echo " verb(scope)!: description" | |
| echo "For scope, please use the affected canister name(s) or 'ci' for infrastructure changes." | |
| exit 1 | |
| fi | |
| check-pr-description: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| pull-requests: read | |
| env: | |
| DESCRIPTION: ${{ github.event.pull_request.body }} | |
| steps: | |
| - name: 'Check PR Description for Jira/Atlassian Links' | |
| if: ${{ github.event_name != 'merge_group' }} | |
| run: | | |
| if [[ "$DESCRIPTION" =~ https:\/\/[a-zA-Z0-9]*\.(atlassian|jira)\.[a-z]{2,3} ]]; then | |
| echo "PR Description contains a link to Jira or Atlassian, which is not allowed." | |
| exit 1 | |
| else | |
| echo "PR Description passes" | |
| fi | |
| check-empty-pr: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| pull-requests: read | |
| contents: read | |
| steps: | |
| - name: Create GitHub App Token | |
| uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | |
| private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ steps.app-token.outputs.token }} | |
| persist-credentials: false | |
| - name: Fetch base branch | |
| run: | | |
| if [ -n "$BASE_REF" ]; then | |
| git fetch origin "$BASE_REF:$BASE_REF" | |
| fi | |
| env: | |
| BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| - name: 'Check for changed files' | |
| id: file_check | |
| run: | | |
| if [[ "$BASE_REV" =~ ^[0-9a-f]{40}$ ]]; then | |
| # In merge groups, we need to fetch the specific commit as it might not be in the shallow clone. | |
| # We check if BASE_REF is empty to avoid fetching from origin (which might be a fork) in PRs. | |
| if [ -z "$BASE_REF" ]; then | |
| git fetch --no-tags --depth=1 origin "$BASE_REV" | |
| fi | |
| BASE_SPEC="$BASE_REV" | |
| else | |
| git fetch --no-tags --depth=1 origin "$BASE_REV" | |
| BASE_SPEC="origin/$BASE_REV" | |
| fi | |
| CHANGED_FILES=$(git diff "$BASE_SPEC" HEAD --name-only | wc -l) | |
| echo "Changed files: $CHANGED_FILES" | |
| if [ "$CHANGED_FILES" -eq "0" ]; then | |
| echo "No changes detected in PR!" | |
| exit 1 | |
| fi | |
| env: | |
| BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| BASE_REV: ${{ github.event.merge_group.base_sha || github.event.merge_group.base_ref || github.event.pull_request.base.sha || github.event.pull_request.base.ref || 'main' }} | |
| pr-checks-pass: | |
| if: always() | |
| needs: ['check-pr-title', 'check-pr-description', 'check-empty-pr'] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/needs_success | |
| with: | |
| needs: '${{ toJson(needs) }}' |