Skip to content

fix: don't pass in a separate env. This makes it impossible to pass env vars via the action context to syft. #68

fix: don't pass in a separate env. This makes it impossible to pass env vars via the action context to syft.

fix: don't pass in a separate env. This makes it impossible to pass env vars via the action context to syft. #68

name: Update snapshots
on:
issue_comment:
types: [created]
jobs:
update-snapshots:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/update-snapshots') }}
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.rest.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: Generate token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
with:
app_id: ${{ secrets.TOKEN_APP_ID }}
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
- name: Add seen reaction
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ github.event.comment.id }}
reactions: eyes
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
token: ${{ steps.generate-token.outputs.token }}
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
- name: Build images
run: |
for distro in alpine centos debian; do
docker build -t localhost:5000/match-coverage/$distro ./tests/fixtures/image-$distro-match-coverage
docker push localhost:5000/match-coverage/${distro}:latest
done
- name: Update snapshots
run: |
# install husky hooks and dependencies:
npm install
# update snapshots
npm run test:update-snapshots
- name: Commit snapshots
run: |
git config --global user.name 'anchore-actions'
git config --global user.email 'anchore-actions@users.noreply.github.com'
git commit -s -am "chore(test): update snapshots"
git push
- name: Add success reaction
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ github.event.comment.id }}
reactions: "+1"