Check for diff and force push (#78)

check for diff before trying to commit

force push to protected branch

---------

Co-authored-by: DevBot NetBird <dev@netbird.io>
This commit is contained in:
Maycon Santos
2023-08-05 00:26:09 +02:00
committed by GitHub
parent cc774de04c
commit 734cc3dfb2
2 changed files with 36 additions and 18 deletions

View File

@@ -32,12 +32,22 @@ jobs:
swagger-codegen generate -i https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml -l openapi -o generator/openapi
npx ts-node generator/index.ts gen --input generator/openapi/openapi.json --output src/pages/ipa/resources
- name: Check git diff and send to output
id: git_diff
run: |
if git --no-pager diff --exit-code; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit and push changes
if: steps.git_diff.outputs.changed == 'true'
run: |
git config --global user.email "dev@netbird.io"
git config --global user.name "DevBot NetBird"
git add -A
git commit -m "Update API pages"
git commit -m "Update API pages with v${{ steps.semver_parser.outputs.fullversion }}"
git remote set-url origin https://x-access-token:${{ secrets.DEV_GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push
git push --force

View File

@@ -239,7 +239,11 @@ echo $response;
<Property name="expires_in" type="integer" required={true}
min={86400}
max={31536000}
>
Expiration time in seconds
</Property>
@@ -255,7 +259,7 @@ echo $response;
>
Setup key groups to auto-assign to peers registered with this key
List of group IDs to auto-assign to peers registered with this key
</Property>
<Property name="usage_limit" type="integer" required={true}
@@ -277,7 +281,7 @@ curl -X POST https://api.netbird.io/api/setup-keys \
--data-raw '{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -291,7 +295,7 @@ const axios = require('axios');
let data = JSON.stringify({
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -327,7 +331,7 @@ url = "https://api.netbird.io/api/setup-keys"
payload = json.dumps({
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -363,7 +367,7 @@ func main() {
payload := strings.NewReader(`{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -417,7 +421,7 @@ request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -435,7 +439,7 @@ MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -469,7 +473,7 @@ curl_setopt_array($curl, array(
CURLOPT_POSTFIELDS => '{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -793,7 +797,11 @@ echo $response;
<Property name="expires_in" type="integer" required={true}
min={86400}
max={31536000}
>
Expiration time in seconds
</Property>
@@ -809,7 +817,7 @@ echo $response;
>
Setup key groups to auto-assign to peers registered with this key
List of group IDs to auto-assign to peers registered with this key
</Property>
<Property name="usage_limit" type="integer" required={true}
@@ -831,7 +839,7 @@ curl -X PUT https://api.netbird.io/api/setup-keys/{keyId} \
--data-raw '{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -845,7 +853,7 @@ const axios = require('axios');
let data = JSON.stringify({
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -881,7 +889,7 @@ url = "https://api.netbird.io/api/setup-keys/{keyId}"
payload = json.dumps({
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -917,7 +925,7 @@ func main() {
payload := strings.NewReader(`{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -971,7 +979,7 @@ request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -989,7 +997,7 @@ MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"
@@ -1023,7 +1031,7 @@ curl_setopt_array($curl, array(
CURLOPT_POSTFIELDS => '{
"name": "Default key",
"type": "reusable",
"expires_in": 43200,
"expires_in": 86400,
"revoked": false,
"auto_groups": [
"devs"