Skip to content

Commit a2914e2

Browse files
authored
fix: danger pin check (#70)
* fix: danger pin check * chore: update changelog
1 parent 3f3a3b4 commit a2914e2

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.9.1
4+
5+
### Fixes
6+
7+
- Danger - fix pinned action check if the ref is at the end of the file ([#70](https://github.com/getsentry/github-workflows/pull/70))
8+
39
## 2.9.0
410

511
### Fixes

danger/CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
## TLDR
99

10-
```shell-script
11-
export DANGER_GITHUB_API_TOKEN='XXX'
12-
export DANGER_FAKE_CI="YEP"
13-
export DANGER_TEST_REPO='username/reponame'
10+
```pwsh
11+
$env:DANGER_GITHUB_API_TOKEN = gh auth token
12+
$env:DANGER_FAKE_CI = 'YEP'
13+
$env:DANGER_TEST_REPO = 'username/reponame'
14+
$env:DANGER_TEST_PR = 1234
15+
1416
cd reponame
15-
export DANGER_TEST_PR='1234'
16-
git checkout branch-for-pr-1234
17+
gh pr checkout $env:DANGER_TEST_PR
1718
npx danger ci --text-only --failOnErrors --dangerfile=../github-workflows/danger/dangerfile.js
1819
```

danger/dangerfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async function checkActionsArePinned() {
146146

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

0 commit comments

Comments
 (0)