Skip to content

Commit 6dd606b

Browse files
committed
feature: setter nå pr til draft dersom valideringen feiler
1 parent 9beb6f0 commit 6dd606b

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

.github/workflows/validatePackageChangesOnPr.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: "[PR] Validate package changes"
22
on:
33
pull_request:
4-
workflow_call:
5-
secrets:
6-
SF_DEVHUB_URL:
7-
required: true
4+
types: [opened, ready_for_review, reopened]
5+
paths:
6+
- "src/**"
87
workflow_dispatch:
98
concurrency:
109
group: ${{ github.workflow }}-${{ github.ref_name }}
@@ -41,13 +40,22 @@ jobs:
4140
runs-on: ubuntu-latest
4241
container: ghcr.io/flxbl-io/sfp:${{ vars.SFP_CONTAINER_VERSION }}
4342
permissions:
44-
contents: read
43+
contents: write
44+
pull-requests: write
45+
env:
46+
POOLS: ${{ vars.DEFAULT_CI_POOL }}
47+
DEVHUB_ALIAS: "devhub"
48+
COVERAGE_PERCENT: ${{ vars.CODE_COVERAGE_PERCENTAGE }}
49+
SFP_LOG_LEVEL: ${{ vars.SFP_LOG_LEVEL }}
50+
EVENT: ${{ github.event_name }}
51+
GH_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
4553
steps:
4654
- name: "Checkout"
4755
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
4856
with:
4957
fetch-depth: 0
50-
persist-credentials: true
58+
persist-credentials: false
5159

5260
- name: Authenticate DevHub
5361
uses: navikt/sf-platform/.github/actions/authenticateOrg@dedb0fe6ba7f5656ae34d5c18acb75ab8228e4ee
@@ -85,15 +93,20 @@ jobs:
8593
echo "Executing command: ${command[*]}"
8694
"${command[@]}"
8795
env:
88-
POOLS: ${{ vars.DEFAULT_CI_POOL }}
89-
DEVHUB_ALIAS: "devhub"
90-
COVERAGE_PERCENT: ${{ vars.CODE_COVERAGE_PERCENTAGE }}
9196
MODE: "thorough"
9297
REF: ${{ github.event.pull_request.head.sha }}
9398
BASE_REF: ${{ github.event.pull_request.base.sha }}
9499
DELETE_SCRATCH: "true"
95-
SFP_LOG_LEVEL: ${{ vars.SFP_LOG_LEVEL }}
96100

97101
- name: Delete Stale Validation Org
98102
if: ${{ failure() }}
99-
run: sf org delete scratch -p
103+
run: |
104+
if sf org list --json | jq -e '.result[] | select(.isDefaultUsername == true)' > /dev/null; then
105+
sf org delete scratch --no-prompt
106+
fi
107+
108+
- name: Set pull request to draft
109+
if: ${{ failure() && github.event_name == 'pull_request' }}
110+
uses: navikt/sf-platform/.github/actions/setPrToDraft@9beb6f0b918e4ecb8c1856d785b91749e7d48215
111+
with:
112+
pullRequestId: ${{ github.event.pull_request.node_id }}

0 commit comments

Comments
 (0)