Add “Copy Code” Button to Documentation Code Blocks #1118
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: urunc CI | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| types: [opened,synchronize,reopened,labeled] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check-labels: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.pull_request.base.ref == 'main' }} | |
| outputs: | |
| skip_build: ${{ steps.set-vars.outputs.skip_build }} | |
| skip_lint: ${{ steps.set-vars.outputs.skip_lint }} | |
| ok_to_test: ${{ steps.set-vars.outputs.ok_to_test }} | |
| takeover: ${{ steps.set-vars.outputs.takeover }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
| with: | |
| egress-policy: audit | |
| - name: Fetch PR Labels | |
| id: get-labels | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const labels = await github.rest.issues.listLabelsOnIssue({ | |
| ...context.repo, | |
| issue_number: prNumber | |
| }); | |
| const names = labels.data.map(l => l.name); | |
| core.setOutput("labels", names.join(',')); | |
| - name: Set skip flags | |
| id: set-vars | |
| run: | | |
| LABELS="${{ steps.get-labels.outputs.labels }}" | |
| echo "Labels: $LABELS" | |
| if [[ "$LABELS" == *"skip-build"* ]]; then | |
| echo "skip_build=yes" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip_build=no" >> $GITHUB_OUTPUT | |
| fi | |
| if [[ "$LABELS" == *"skip-lint"* ]]; then | |
| echo "skip_lint=yes" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip_lint=no" >> $GITHUB_OUTPUT | |
| fi | |
| if [[ "$LABELS" == *"ok-to-test"* ]]; then | |
| echo "ok_to_test=yes" >> $GITHUB_OUTPUT | |
| else | |
| echo "ok_to_test=no" >> $GITHUB_OUTPUT | |
| fi | |
| if [[ "$LABELS" == *"takeover"* ]]; then | |
| echo "takeover=yes" >> $GITHUB_OUTPUT | |
| else | |
| echo "takeover=no" >> $GITHUB_OUTPUT | |
| fi | |
| ci-on-push: | |
| needs: [check-labels] | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| pull-requests: read | |
| if: ${{ needs.check-labels.outputs.ok_to_test == 'yes' && | |
| github.event.pull_request.base.ref == 'main' && | |
| needs.check-labels.outputs.takeover == 'no' }} | |
| uses: ./.github/workflows/ci.yml | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| skip-build: ${{ needs.check-labels.outputs.skip_build }} | |
| skip-lint: ${{ needs.check-labels.outputs.skip_lint }} | |
| secrets: inherit |