Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: danger pin check #70

Merged
merged 2 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 2.9.1

### Fixes

- Danger - fix pinned action check if the ref is at the end of the file ([#70](https://github.com/getsentry/github-workflows/pull/70))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 🚫 The changelog entry seems to be part of an already released section ## 2.9.1.
    Consider moving the entry to the ## Unreleased section, please.


## 2.9.0

### Fixes
Expand Down
13 changes: 7 additions & 6 deletions danger/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

## TLDR

```shell-script
export DANGER_GITHUB_API_TOKEN='XXX'
export DANGER_FAKE_CI="YEP"
export DANGER_TEST_REPO='username/reponame'
```pwsh
$env:DANGER_GITHUB_API_TOKEN = gh auth token
$env:DANGER_FAKE_CI = 'YEP'
$env:DANGER_TEST_REPO = 'username/reponame'
$env:DANGER_TEST_PR = 1234

cd reponame
export DANGER_TEST_PR='1234'
git checkout branch-for-pr-1234
gh pr checkout $env:DANGER_TEST_PR
npx danger ci --text-only --failOnErrors --dangerfile=../github-workflows/danger/dangerfile.js
```
2 changes: 1 addition & 1 deletion danger/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async function checkActionsArePinned() {

const usesRegex = /^\+? *uses:/;
const usesActionRegex =
/^\+? *uses: *(?<user>[^\/]+)\/(?<action>[^@]+)@(?<ref>[^ ]*)/;
/^\+? *uses: *(?<user>[^\/]+)\/(?<action>[^@]+)@(?<ref>[^\s]+)/;
const usesLocalRegex = /^\+? *uses: *\.\//; // e.g. 'uses: ./.github/actions/something'
const shaRegex = /^[a-f0-9]{40}$/;
const whitelistedUsers = ["getsentry", "actions", "github"];
Expand Down
Loading