fix(deps): bump github.com/opentdf/platform/lib/ocrypto from 0.7.0 to 0.8.0 in /service #827
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: Label Pull Requests | |
| on: | |
| pull_request_target: # zizmor: ignore[dangerous-triggers] this is needed to label PRs from forks | |
| types: | |
| - opened | |
| - reopened | |
| - unlabeled | |
| permissions: {} | |
| jobs: | |
| labeler: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 | |
| size-pr: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| runs-on: ubuntu-latest | |
| name: Label the PR size | |
| steps: | |
| - uses: codelytv/pr-size-labeler@4ec67706cd878fbc1c8db0a5dcd28b6bb412e85a # v1.10.3 | |
| with: | |
| files_to_ignore: | | |
| "protocol/**/*" | |
| "docs/**/*" | |
| "*_test.go" | |
| external-contributor: | |
| if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.actor != 'opentdf-automation[bot]' }} | |
| permissions: | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Generate a GitHub app token" | |
| id: generate-token | |
| uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.AUTOMATION_KEY }} | |
| - name: Check Author Association and Label PR | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| github-token: ${{ steps.generate-token.outputs.token }} | |
| script: | | |
| const pr = context.payload.pull_request; | |
| if (!pr) { | |
| core.error("Could not get PR from context"); | |
| return; | |
| } | |
| // Label to add if the author is external | |
| const externalLabel = "external-contributor"; | |
| // Check if the user is a member of the org using the GitHub API | |
| let isOrgMember = false; | |
| try { | |
| const { data } = await github.rest.orgs.getMembershipForUser({ | |
| org: context.repo.owner, | |
| username: pr.user.login | |
| }); | |
| if (data && data.state === "active") { | |
| isOrgMember = true; | |
| } | |
| } catch (error) { | |
| if (error.status !== 404) throw error; // only ignore 404s | |
| } | |
| const isExternal = !isOrgMember; | |
| const prLabels = pr.labels.map(label => label.name); | |
| const hasExternalLabel = prLabels.includes(externalLabel); | |
| core.info(`Event: ${context.eventName}, Action: ${context.payload.action}`); | |
| core.info(`Author: ${pr.user.login}, Is Org Member: ${isOrgMember}, Is External: ${isExternal}`); | |
| core.info(`Current PR Labels: ${prLabels.join(', ')}`); | |
| // Logic for 'unlabeled' event: only re-add if *our* label was removed and author is still external | |
| if (context.eventName === 'pull_request_target' && context.payload.action === 'unlabeled') { | |
| const removedLabel = context.payload.label.name; | |
| core.info(`Label removed: ${removedLabel}`); | |
| if (removedLabel === externalLabel && isExternal) { | |
| core.info(`External label was removed, author is still external. Re-adding label: ${externalLabel}`); | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| labels: [externalLabel] | |
| }); | |
| core.info(`Label "${externalLabel}" re-added successfully.`); | |
| } else { | |
| core.info(`Removed label was not the external label or author is not external. No action needed for unlabeled event.`); | |
| } | |
| } | |
| // Logic for 'opened' or 'reopened' events: add label if external and not already present | |
| else if (['opened', 'reopened'].includes(context.payload.action)) { | |
| if (isExternal && !hasExternalLabel) { | |
| core.info(`Author is external and label is missing. Adding label: ${externalLabel}`); | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| labels: [externalLabel] | |
| }); | |
| core.info(`Label "${externalLabel}" added successfully.`); | |
| } else if (isExternal && hasExternalLabel) { | |
| core.info(`Author is external, but label "${externalLabel}" is already present.`); | |
| } else { | |
| if (hasExternalLabel) { | |
| core.warning(`Author is internal. However, external contributor label is present.`) | |
| } else { | |
| core.info(`Author is internal. No label added.`) | |
| } | |
| } | |
| } |