|
1 | 1 | name: "[PR] Validate package changes" |
2 | 2 | on: |
3 | 3 | 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/**" |
8 | 7 | workflow_dispatch: |
9 | 8 | concurrency: |
10 | 9 | group: ${{ github.workflow }}-${{ github.ref_name }} |
@@ -41,13 +40,22 @@ jobs: |
41 | 40 | runs-on: ubuntu-latest |
42 | 41 | container: ghcr.io/flxbl-io/sfp:${{ vars.SFP_CONTAINER_VERSION }} |
43 | 42 | 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 }} |
45 | 53 | steps: |
46 | 54 | - name: "Checkout" |
47 | 55 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
48 | 56 | with: |
49 | 57 | fetch-depth: 0 |
50 | | - persist-credentials: true |
| 58 | + persist-credentials: false |
51 | 59 |
|
52 | 60 | - name: Authenticate DevHub |
53 | 61 | uses: navikt/sf-platform/.github/actions/authenticateOrg@dedb0fe6ba7f5656ae34d5c18acb75ab8228e4ee |
@@ -85,15 +93,20 @@ jobs: |
85 | 93 | echo "Executing command: ${command[*]}" |
86 | 94 | "${command[@]}" |
87 | 95 | env: |
88 | | - POOLS: ${{ vars.DEFAULT_CI_POOL }} |
89 | | - DEVHUB_ALIAS: "devhub" |
90 | | - COVERAGE_PERCENT: ${{ vars.CODE_COVERAGE_PERCENTAGE }} |
91 | 96 | MODE: "thorough" |
92 | 97 | REF: ${{ github.event.pull_request.head.sha }} |
93 | 98 | BASE_REF: ${{ github.event.pull_request.base.sha }} |
94 | 99 | DELETE_SCRATCH: "true" |
95 | | - SFP_LOG_LEVEL: ${{ vars.SFP_LOG_LEVEL }} |
96 | 100 |
|
97 | 101 | - name: Delete Stale Validation Org |
98 | 102 | 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