Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger-petstore #160

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/dynamic-vars-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Dynamic Vars Tasks

on:
workflow_dispatch:
inputs:
SNAPSHOT_BUILD_VERSION:
description: 'Snapshot build version'
required: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '11'

- name: Create branch
run: |
git checkout -b dynamic-vars-tasks

- name: Update pom.xml with snapshot build version
run: |
sed -i "s/<version>.*<\/version>/<version>${SNAPSHOT_BUILD_VERSION}<\/version>/" pom.xml

- name: Build
run: |
mvn clean package -Dmaven.test.skip=true

- name: Commit changes
run: |
git add .
git commit -m "Update pom.xml with snapshot build version ${SNAPSHOT_BUILD_VERSION}"

- name: Push changes to branch
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true

- name: Create PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Update pom.xml with snapshot build version ${SNAPSHOT_BUILD_VERSION}',
head: 'dynamic-vars-tasks',
base: 'main',
body: 'Automatically generated PR'
})

- name: CodeQL scanning
uses: github/codeql-action/analyze@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
languages: java

- name: Merge PR
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: github.context.pullRequest.number,
commit_title: 'Merge PR',
commit_message: 'Automatically merged PR'
})