github actions workflows - wip

This commit is contained in:
Joey Orlando 2024-06-05 13:46:07 -04:00
parent cdd8354702
commit 705bdb1d5a
No known key found for this signature in database
GPG key ID: 469E88366B17F644
2 changed files with 29 additions and 15 deletions

View file

@ -23,7 +23,7 @@ jobs:
- name: Checkout project
uses: actions/checkout@v3
- name: Set engine version number in settings file
uses: ./.github/actions/set-engine-version-number-in-settings/action.yml
uses: ./.github/actions/set-engine-version-in-settings/action.yml
with:
working_directory: .
engine_version_number: ${{ inputs.engine_version }}

View file

@ -37,7 +37,7 @@ jobs:
id: build-sign-and-package-plugin
uses: ./.github/actions/build-sign-and-package-plugin
with:
plugin_version_number: ${{ inputs.plugin_version_number }}
plugin_version_number: ${{ github.ref_name }}
grafana_access_policy_token: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN }}
working_directory: grafana-plugin
- name: Authenticate with GCS
@ -92,19 +92,33 @@ jobs:
with:
repo_secrets: |
GITHUB_API_KEY=github_actions:github-api-key
- name: Merge Helm release PR
# yamllint disable rule:line-length
- name: Slice v from the tag
id: prepare-version-tag
run: |
# Step 1. Fetch PRs from GitHub's API that're open and have a particular head ref indicative of a helm release PR
# API docs - https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests
# NOTE: ${github.ref_name:1} will slice off the "v" prefix from the tag
echo processed-tag="${GITHUB_REF_NAME:1}" >> $GITHUB_OUTPUT
- name: Find Helm release pull request
uses: juliangruber/find-pull-request-action@v1
id: find-pull-request
with:
branch: helm-release/${{ steps.prepare-version-tag.outputs.processed-tag }}
- name: Merge pull Request
uses: juliangruber/merge-pull-request-action@v1
with:
github-token: ${{ env.GITHUB_API_KEY }}
number: ${{ steps.find-pull-request.outputs.number }}
# - name: Fetch PRs from GitHub's API
# # yamllint disable rule:line-length
# run: |
# # Step 1. Fetch PRs from GitHub's API that're open and have a particular head ref indicative of a helm release PR
# # API docs - https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests
# # NOTE: ${github.ref_name:1} will slice off the "v" prefix from the tag
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${{ env.GITHUB_API_KEY }}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/grafana/oncall/pulls?head=grafana:helm-release/$${{ github.ref_name }}:1}&state=open" > prs.json
cat prs.json
# curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${GITHUB_API_KEY }" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/grafana/oncall/pulls?head=grafana:helm-release/$${GITHUB_REF_NAME}:1}&state=open" > prs.json
# cat prs.json
# Step 2. Extract the PR number from the first PR in the list to be able to pass that to the next API call
cat prs.json | jq -r ".[0].number" > pr_number.txt
cat pr_number.txt
# Step 3. Merge the PR (https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request)
cat pr_number.txt | xargs -r -I{pull_number} curl -L -X PUT -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${{ env.GITHUB_API_KEY }}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/grafana/oncall/pulls/{pull_number}/merge"
# yamllint enable rule:line-length
# # Step 2. Extract the PR number from the first PR in the list to be able to pass that to the next API call
# cat prs.json | jq -r ".[0].number" > pr_number.txt
# cat pr_number.txt
# # Step 3. Merge the PR (https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request)
# cat pr_number.txt | xargs -r -I{pull_number} curl -L -X PUT -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $${{ env.GITHUB_API_KEY }}" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/grafana/oncall/pulls/{pull_number}/merge"
# # yamllint enable rule:line-length