deps(ci): bump actions/checkout from 4.1.6 to 4.1.7 (#140) #62
This file contains 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: test-commit-status | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "commit-status-and-label/**" | |
- ".github/workflows/test-commit-status.yml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "commit-status-and-label/**" | |
- ".github/workflows/test-commit-status.yml" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: {} | |
jobs: | |
test-commit-status: | |
name: test-commit-status | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
statuses: write | |
steps: | |
- name: step-security/harden-runner | |
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Update Status | |
id: check_pending | |
uses: ./commit-status-and-label | |
if: github.event_name == 'pull_request' | |
with: | |
token: ${{ github.token }} | |
sha: ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }} | |
state: "pending" | |
- name: Update Status | |
id: test_commit_status_update | |
uses: ./commit-status-and-label | |
with: | |
token: ${{ github.token }} | |
sha: ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }} | |
state: "pending" | |
context: "test-commit-status" | |
label_prefix: "commit_status_tests: " | |
- name: Check Status | |
id: check | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
response = await github.request('GET /repos/{owner}/{repo}/commits/{ref}/status', { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: '${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }}', | |
headers: { | |
'X-GitHub-Api-Version': '2022-11-28' | |
} | |
}) | |
const status=response.data.statuses.filter((status) => status.context === 'test-commit-status' && status.state === 'pending'); | |
if (status.length < 1) { | |
throw new Error('Expected at least one status to be pending'); | |
} | |
- name: Update Status | |
id: update_commit_status | |
if: success() || failure() | |
uses: ./commit-status-and-label | |
with: | |
token: ${{ github.token }} | |
sha: ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }} | |
state: ${{ steps.check.outcome }} | |
context: "test-commit-status" | |
label_prefix: "commit_status_tests: " | |
- name: Check Status | |
id: check_outcome | |
uses: ./commit-status-and-label | |
if: | | |
(success() || failure()) && | |
github.event_name == 'pull_request' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
sha: ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }} | |
state: "${{ steps.check.outcome }}" | |
notification: | |
name: notification | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- test-commit-status | |
if: | | |
github.event_name == 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: dispatch | |
uses: ./pr-trigger | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
event_type: "pr-commit-status-test-success" |