🌱 Bump cloud.google.com/go/pubsub from 1.43.0 to 1.45.0 #1715
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: scdiff PR evaluation | |
on: | |
issue_comment: | |
types: [created] | |
permissions: read-all | |
env: | |
GO_VERSION: 1.23 | |
jobs: | |
share-link: | |
if: ${{ (github.event.issue.pull_request) && (contains(github.event.comment.body, '/scdiff generate')) }} | |
runs-on: [ubuntu-latest] | |
permissions: | |
pull-requests: write # to create the PR comment | |
steps: | |
- name: share link to workflow run | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `[Here's a link to the scdiff run](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})` | |
}) | |
golden-test: | |
if: ${{ (github.event.issue.pull_request) && (contains(github.event.comment.body, '/scdiff generate')) }} | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: create file of repos to analyze | |
run: | | |
cat <<EOF > $HOME/repos.txt | |
https://github.com/airbnb/lottie-web | |
https://github.com/apache/tomcat | |
https://github.com/Azure/azure-functions-dotnet-worker | |
https://github.com/cncf/xds | |
https://github.com/google/go-cmp | |
https://github.com/google/highwayhash | |
https://github.com/googleapis/google-api-php-client | |
https://github.com/jacoco/jacoco | |
https://github.com/ossf/scorecard | |
https://github.com/pallets/jinja | |
https://github.com/polymer/polymer | |
https://github.com/rust-random/getrandom | |
https://github.com/yaml/libyaml | |
https://gitlab.com/baserow/baserow | |
https://gitlab.com/cryptsetup/cryptsetup | |
EOF | |
- name: configure scdiff | |
id: config | |
env: | |
COMMENT_BODY: ${{ github.event.comment.body }} | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
script: | | |
const allowedAssociations = ["COLLABORATOR", "MEMBER", "OWNER"]; | |
authorAssociation = '${{ github.event.comment.author_association }}' | |
if (!allowedAssociations.includes(authorAssociation)) { | |
core.setFailed("You don't have access to run scdiff"); | |
return | |
} | |
const response = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number, | |
}) | |
// avoid race condition between scdiff comment and fetching PR head sha | |
const commentTime = new Date('${{ github.event.comment.created_at }}'); | |
const prTime = new Date(response.data.head.repo.pushed_at) | |
if (prTime >= commentTime) { | |
core.setFailed("The PR may have been updated since the scdiff request, " + | |
"please review any changes and relaunch if safe."); | |
return | |
} | |
core.setOutput('base', response.data.base.sha) | |
core.setOutput('head', response.data.head.sha) | |
checks = '""' | |
const commentBody = process.env.COMMENT_BODY | |
const regex = /\/scdiff generate ([^ ]+)/; | |
const found = commentBody.match(regex); | |
if (found && found.length == 2) { | |
checks = found[1] | |
} | |
core.exportVariable('SCORECARD_CHECKS', checks) | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
ref: ${{ steps.config.outputs.base }} | |
- name: Setup Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- name: generate before results | |
env: | |
GITHUB_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} | |
GITLAB_AUTH_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
run: | | |
go run cmd/internal/scdiff/main.go generate \ | |
--repos $HOME/repos.txt \ | |
--checks $SCORECARD_CHECKS > $HOME/before.json | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
ref: ${{ steps.config.outputs.head }} | |
- name: generate after results | |
env: | |
GITHUB_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} | |
GITLAB_AUTH_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
run: | | |
go run cmd/internal/scdiff/main.go generate \ | |
--repos $HOME/repos.txt \ | |
--checks $SCORECARD_CHECKS > $HOME/after.json | |
- name: compare results | |
run: | | |
go run cmd/internal/scdiff/main.go compare $HOME/before.json $HOME/after.json |