Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.

Commit d335be4

Browse files
merge: resolved merge with 'bugfix/callbacks-workflows'
Signed-off-by: Matheus Ferreira <matheus.ferreira@zup.com.br>
2 parents 455fb8d + 76da3d5 commit d335be4

File tree

5 files changed

+110
-19
lines changed

5 files changed

+110
-19
lines changed

.github/workflows/check-callback.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,29 @@
1717
name: Check callback
1818

1919
on:
20-
repository_dispatch:
21-
type: [SECURITY, RELEASE, RELEASED]
20+
workflow_call:
21+
secrets:
22+
accessToken:
23+
required: true
2224

2325
jobs:
2426
check_callback:
2527
name: Check Callback
2628
runs-on: ubuntu-latest
2729
steps:
30+
- name: Check state - ${{ github.event.client_payload.state }}
31+
id: check_state
32+
if: |
33+
!contains(fromJson('["pending", "success", "failure"]'), github.event.client_payload.state)
34+
run: |
35+
echo "Invalid state"
36+
exit 1
2837
- name: Callback - ${{ github.event.client_payload.state }}
2938
if: contains(fromJson('["pending", "success", "failure"]'), github.event.client_payload.state)
3039
run: |
3140
curl --request POST \
3241
--url ${{ github.event.client_payload.statuses_href }} \
33-
-u '${{ secrets.ACCESS_TOKEN }}' \
42+
-u '${{ secrets.accessToken }}' \
3443
--header 'content-type: application/vnd.github+json' \
3544
-o result.json \
3645
--silent \
@@ -40,13 +49,12 @@ jobs:
4049
"description": "${{ github.event.client_payload.description }}",
4150
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
4251
}'
43-
44-
- name: Intenal error ❌
45-
if: ${{ failure() && github.event.client_payload.state != 'failure'}}
52+
- name: Internal error ❌
53+
if: failure()
4654
run: |
4755
curl --request POST \
4856
--url ${{ github.event.client_payload.statuses_href }} \
49-
-u '${{ secrets.ACCESS_TOKEN }}' \
57+
-u '${{ secrets.accessToken }}' \
5058
--header 'content-type: application/vnd.github+json' \
5159
-o error.json \
5260
--silent \
@@ -55,15 +63,4 @@ jobs:
5563
"state": "error",
5664
"description": "Internal error",
5765
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
58-
}'
59-
60-
publish:
61-
name: Publish Plugin in Marketplace
62-
needs:
63-
- check_callback
64-
if: ${{ success() && github.event.event_type == 'RELEASED' }}
65-
uses: stack-spot/stackspot-intellij-extension/.github/workflows/publish-release.yml@main
66-
secrets:
67-
accessToken: ${{ secrets.ACCESS_TOKEN }}
68-
publishToken: ${{ secrets.PUBLISH_TOKEN }}
69-
marketplaceChannel: ${{ secrets.MARKETPLACE_CHANNEL }}
66+
}'

.github/workflows/prereleased.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Pre released
18+
19+
on:
20+
repository_dispatch:
21+
type: [RELEASE]
22+
23+
jobs:
24+
check_callback:
25+
name: Check callback
26+
uses: stack-spot/stackspot-intellij-extension/.github/workflows/check-callback.yml@main
27+
secrets:
28+
accessToken: ${{ secrets.ACCESS_TOKEN }}

.github/workflows/released.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Released
18+
19+
on:
20+
repository_dispatch:
21+
type: [RELEASED]
22+
23+
jobs:
24+
check_callback:
25+
name: Check callback
26+
uses: stack-spot/stackspot-intellij-extension/.github/workflows/check-callback.yml@main
27+
secrets:
28+
accessToken: ${{ secrets.ACCESS_TOKEN }}
29+
30+
publish:
31+
name: Publish Plugin
32+
needs:
33+
- check_callback
34+
uses: stack-spot/stackspot-intellij-extension/.github/workflows/publish-marketplace.yml@main
35+
secrets:
36+
accessToken: ${{ secrets.ACCESS_TOKEN }}
37+
publishToken: ${{ secrets.PUBLISH_TOKEN }}
38+
marketplaceChannel: ${{ secrets.MARKETPLACE_CHANNEL }}

.github/workflows/security.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Copyright 2022 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Security
18+
19+
on:
20+
repository_dispatch:
21+
type: [SECURITY]
22+
23+
jobs:
24+
check_callback:
25+
name: Check callback
26+
uses: stack-spot/stackspot-intellij-extension/.github/workflows/check-callback.yml@main
27+
secrets:
28+
accessToken: ${{ secrets.ACCESS_TOKEN }}

0 commit comments

Comments
 (0)