-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Merge Changes | ||
description: Open PR with changes and merge it if all tests are passed | ||
inputs: | ||
target-branch: | ||
description: Target branch for the changes to be merged into | ||
required: true | ||
default: ${{ github.event.repository.default_branch }} | ||
current-branch: | ||
description: Current branch | ||
required: false | ||
default: automatic-plugin-examples-update | ||
commit-message: | ||
description: Commit message | ||
required: true | ||
default: Commit changes from CI | ||
app-id: | ||
description: GitHub App ID | ||
required: true | ||
app-pem: | ||
description: GitHub App PEM | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Git configuration | ||
shell: bash | ||
run: | | ||
git config user.name 'grafana-delivery-bot[bot]' | ||
git config user.email '132647405+grafana-delivery-bot[bot]@users.noreply.github.com' | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v2 | ||
with: | ||
app_id: "${{ inputs.app-id }}" | ||
private_key: "${{ inputs.app-pem }}" | ||
|
||
- name: Create a branch | ||
shell: bash | ||
run: git checkout --progress -B ${{ inputs.current-branch }} | ||
|
||
# - name: Commit changes | ||
# shell: bash | ||
# run: | | ||
# git add --all -- . | ||
# git commit -m "${{ inputs.commit-message }}" | ||
# git show --stat | ||
|
||
# - name: Push changes | ||
# shell: bash | ||
# run: git push origin ${{ inputs.current-branch }} --force-with-lease | ||
|
||
- name: Create PR | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
branch: new-update-plugin-examples | ||
delete-branch: true | ||
commit-message: 'chore: update configuration to latest version' | ||
title: 'Chore: Bump plugin-examples configuration to latest version' | ||
body: | | ||
Bumps [`grafana-plugin-examples`](https://github.com/grafana/grafana-plugin-examples) configuration to the latest version. | ||
**Notes for reviewer:** | ||
This is an auto-generated PR which ran `npx -y @grafana/create-plugin@latest update`, updates plugin.json files and docker-compose files for each plugin example | ||
Please review the changes thoroughly before merging. | ||
# - name: Clean up | ||
# if: ${{ cancelled() }} | ||
# shell: bash | ||
# run: | | ||
# git checkout ${{ inputs.target-branch }} | ||
# git branch -D ${{ inputs.current-branch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,30 @@ | ||
name: Update Grafana Version | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 1 * *' # Runs at 00:00 on the first day of every month | ||
workflow_dispatch: # Allows you to manually trigger the workflow | ||
on: push | ||
# schedule: | ||
# - cron: '0 0 1 * *' # Runs at 00:00 on the first day of every month | ||
# workflow_dispatch: # Allows you to manually trigger the workflow | ||
|
||
jobs: | ||
update-grafana: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Git configuration | ||
run: | | ||
git config user.name 'github-actions' | ||
git config user.email '[email protected]' | ||
- name: Set up permissions | ||
run: chmod +x scripts/update-grafana-version.sh | ||
uses: actions/checkout@v4 | ||
|
||
- name: Update Grafana version | ||
run: scripts/update-grafana-version.sh | ||
|
||
- name: Commit changes | ||
run: | | ||
git add . | ||
git commit -m "Update Grafana version" | ||
continue-on-error: true | ||
bash scripts/update-grafana-version.sh | ||
git status | ||
- name: Push changes | ||
- name: Check the status of the repo | ||
id: status | ||
run: | | ||
git push origin update-grafana-version | ||
continue-on-error: true | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: update-grafana-version | ||
title: Update Grafana version | ||
body: Automatic update of Grafana version. | ||
labels: automatic update | ||
assignees: ${{ github.actor }} | ||
|
||
test-and-merge: | ||
needs: update-grafana | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run tests | ||
run: ./scripts/run-tests.sh # Adjust this command to your test script | ||
echo "status=$(git diff-index --quiet --exit-code HEAD && echo '0' || echo '1')" >> $GITHUB_OUTPUT | ||
- name: Merge Pull Request | ||
if: success() | ||
uses: actions/github-script@v3 | ||
- name: Apply changes | ||
if: ${{ steps.status.outputs.status == '1' }} | ||
uses: ./.github/actions/merge-changes | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const pullRequest = context.payload.pull_request; | ||
if (pullRequest) { | ||
await github.pulls.merge({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: pullRequest.number, | ||
merge_method: 'merge' | ||
}); | ||
} | ||
app-id: ${{ secrets.APP_ID }} | ||
app-pem: ${{ secrets.APP_PEM }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters