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

Commit c300daf

Browse files
feature: created workflows for integration with another repository (#7)
Signed-off-by: Adroaldo Neto <adroaldo.neto@zup.com.br> Signed-off-by: Adroaldo Neto <adroaldo.neto@zup.com.br>
1 parent d4b91ea commit c300daf

File tree

4 files changed

+225
-0
lines changed

4 files changed

+225
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#
2+
# Copyright 2020, 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: Check callback
18+
19+
on:
20+
repository_dispatch:
21+
type: [SECURITY, RELEASE, TAG]
22+
23+
jobs:
24+
CHECK_CALLBACK:
25+
runs-on: ubuntu-latest
26+
steps:
27+
28+
- name: Callback - ${{ github.event.client_payload.state }}
29+
if: contains(fromJson('["pending", "success", "failure"]'), github.event.client_payload.state)
30+
run: |
31+
curl --request POST \
32+
--url ${{ github.event.client_payload.statuses_href }} \
33+
-u '${{ secrets.ACCESS_TOKEN }}' \
34+
--header 'content-type: application/vnd.github+json' \
35+
-o result.json \
36+
--data '{
37+
"context": "${{ github.event.action }} - Check callback",
38+
"state": "${{ github.event.client_payload.state }}",
39+
"description": "${{ github.event.client_payload.description }}",
40+
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
41+
}'
42+
43+
44+
- name: Intenal error ❌
45+
if: ${{ failure() && github.event.client_payload.state != 'failure'}}
46+
run: |
47+
curl --request POST \
48+
--url ${{ github.event.client_payload.statuses_href }} \
49+
-u '${{ secrets.ACCESS_TOKEN }}' \
50+
--header 'content-type: application/vnd.github+json' \
51+
-o error.json \
52+
--data '{
53+
"context": "${{ github.event.action }} - Check callback",
54+
"state": "error",
55+
"description": "Internal error",
56+
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
57+
}'
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#
2+
# Copyright 2020, 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: Deploy production
18+
19+
on:
20+
push:
21+
branches:
22+
- release-*
23+
24+
jobs:
25+
RELEASE:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Change to pending status
29+
run: |
30+
curl --request POST \
31+
--url ${{ github.event.pull_request._links.statuses.href}} \
32+
-u '${{ secrets.ACCESS_TOKEN }}' \
33+
--header 'content-type: application/vnd.github+json' \
34+
-o result.json \
35+
--data '{
36+
"context": "RELEASE - Check callback",
37+
"state": "pending",
38+
"description": "Waiting to start",
39+
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
40+
}'
41+
42+
- name: Dispatch init event
43+
run: |
44+
curl -X POST https://api.github.com/repos/stack-spot/stackspot-intellij-plugin/dispatches \
45+
-H 'Accept: application/vnd.github.everest-preview+json' \
46+
-u ${{ secrets.ACCESS_TOKEN }} \
47+
-o response.json \
48+
--data '{
49+
"event_type": "RELEASE",
50+
"client_payload": {
51+
"ref": "${{ github.ref }}",
52+
"ref_name": "${{ github.ref_name }}",
53+
"repository_owner": "${{ github.repository_owner }}",
54+
"repository_name": "${{ github.event.repository.name }}",
55+
"statuses_href": "${{ github.event.pull_request._links.statuses.href}}"
56+
}
57+
}'

.github/workflows/deploy-prod.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# Copyright 2020, 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: Deploy production
18+
19+
on:
20+
push:
21+
branches:
22+
- v*.*.*
23+
24+
jobs:
25+
VERSION:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Change to pending status
29+
run: |
30+
curl --request POST \
31+
--url ${{ github.event.pull_request._links.statuses.href}} \
32+
-u '${{ secrets.ACCESS_TOKEN }}' \
33+
--header 'content-type: application/vnd.github+json' \
34+
-o result.json \
35+
--data '{
36+
"context": "TAG - Check callback",
37+
"state": "pending",
38+
"description": "Waiting to start",
39+
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
40+
}'
41+
42+
- name: Dispatch init event
43+
run: |
44+
curl -X POST https://api.github.com/repos/stack-spot/stackspot-intellij-plugin/dispatches \
45+
-H 'Accept: application/vnd.github.everest-preview+json' \
46+
-u ${{ secrets.ACCESS_TOKEN }} \
47+
--data '{
48+
"event_type": "TAG",
49+
"client_payload": {
50+
"ref": "${{ github.ref }}",
51+
"ref_name": "${{ github.ref_name }}",
52+
"repository_owner": "${{ github.repository_owner }}",
53+
"repository_name": "${{ github.event.repository.name }}",
54+
"statuses_href": "${{ github.event.pull_request._links.statuses.href}}"
55+
}
56+
}'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# Copyright 2020, 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 Pipeline
18+
19+
on:
20+
pull_request:
21+
22+
jobs:
23+
SAST:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Change to pending status
27+
run: |
28+
curl --request POST \
29+
--url ${{ github.event.pull_request._links.statuses.href}} \
30+
-u '${{ secrets.ACCESS_TOKEN }}' \
31+
--header 'content-type: application/vnd.github+json' \
32+
-o result.json \
33+
--data '{
34+
"context": "SECURITY - Check callback",
35+
"state": "pending",
36+
"description": "Waiting to start",
37+
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
38+
}'
39+
40+
- name: Dispatch init event
41+
run: |
42+
curl -X POST https://api.github.com/repos/stack-spot/stackspot-intellij-plugin/dispatches \
43+
-H 'Accept: application/vnd.github.everest-preview+json' \
44+
-u ${{ secrets.ACCESS_TOKEN }} \
45+
--data '{
46+
"event_type": "SAST",
47+
"client_payload": {
48+
"ref": "${{ github.ref }}",
49+
"ref_name": "${{ github.ref_name }}",
50+
"repository_owner": "${{ github.repository_owner }}",
51+
"repository_name": "${{ github.event.repository.name }}",
52+
"statuses_href": "${{ github.event.pull_request._links.statuses.href}}"
53+
}
54+
}'
55+

0 commit comments

Comments
 (0)