mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 12:07:54 +00:00
gh action: fix plugin check workflow (#22084)
* gh action: fix plugin check workflow * use if condition
This commit is contained in:
committed by
GitHub
parent
727c73cbd1
commit
a31c680b9c
2
.github/workflows/plugin-update-check.yml
vendored
2
.github/workflows/plugin-update-check.yml
vendored
@@ -82,7 +82,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$vault_pr_num" ]; then
|
if [ -z "${{ steps.pr.outputs.vault_pr_url }}" ]; then
|
||||||
echo "error: no vault PR found"
|
echo "error: no vault PR found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
26
.github/workflows/plugin-update.yml
vendored
26
.github/workflows/plugin-update.yml
vendored
@@ -6,11 +6,11 @@ on:
|
|||||||
inputs:
|
inputs:
|
||||||
repo:
|
repo:
|
||||||
type: string
|
type: string
|
||||||
description: 'The owner and repository name as per the github.repository context property.'
|
description: 'The owner and repository name. Ex: hashicorp/vault-plugin-auth-jwt'
|
||||||
required: true
|
required: true
|
||||||
plugin_tag:
|
plugin_tag:
|
||||||
type: string
|
type: string
|
||||||
description: 'The name of the plugin tag.'
|
description: 'The name of the plugin tag. Ex: v0.5.1'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config user.name hc-github-team-secure-vault-ecosystem
|
git config user.name hc-github-team-secure-vault-ecosystem
|
||||||
git config user.email hc-github-team-secure-vault-ecosystem@users.noreply.github.com
|
git config user.email hc-github-team-secure-vault-ecosystem@users.noreply.github.com
|
||||||
git add .
|
git add go.mod go.sum
|
||||||
git commit -m "Automated dependency upgrades"
|
git commit -m "Automated dependency upgrades"
|
||||||
git push -f origin ${{ github.ref_name }}:"$VAULT_BRANCH"
|
git push -f origin ${{ github.ref_name }}:"$VAULT_BRANCH"
|
||||||
|
|
||||||
@@ -63,8 +63,9 @@ jobs:
|
|||||||
if [ -z "$PR" ]; then
|
if [ -z "$PR" ]; then
|
||||||
gh pr create \
|
gh pr create \
|
||||||
--head "$VAULT_BRANCH" \
|
--head "$VAULT_BRANCH" \
|
||||||
|
--reviewer "${{ github.actor }}" \
|
||||||
--title "Update ${{ inputs.repo }} to ${{ inputs.plugin_tag }}" \
|
--title "Update ${{ inputs.repo }} to ${{ inputs.plugin_tag }}" \
|
||||||
--body "Updates ${{ inputs.repo }} to verify vault CI. Full log: https://github.com/hashicorp/vault/actions/runs/${{ github.run_id }}"
|
--body "This PR was generated by a GitHub Action. Full log: https://github.com/hashicorp/vault/actions/runs/${{ github.run_id }}"
|
||||||
|
|
||||||
echo "vault_pr_num=$(gh pr list --head "$VAULT_BRANCH" --json number -q '.[0].number')" >> "$GITHUB_OUTPUT"
|
echo "vault_pr_num=$(gh pr list --head "$VAULT_BRANCH" --json number -q '.[0].number')" >> "$GITHUB_OUTPUT"
|
||||||
echo "vault_pr_url=$(gh pr list --head "$VAULT_BRANCH" --json url -q '.[0].url')" >> "$GITHUB_OUTPUT"
|
echo "vault_pr_url=$(gh pr list --head "$VAULT_BRANCH" --json url -q '.[0].url')" >> "$GITHUB_OUTPUT"
|
||||||
@@ -73,13 +74,8 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Add changelog
|
- name: Add changelog
|
||||||
continue-on-error: true
|
if: steps.pr.outputs.vault_pr_num != ''
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$vault_pr_num" ]; then
|
|
||||||
echo "error: no vault PR found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# strip "hashicorp/" from repo name
|
# strip "hashicorp/" from repo name
|
||||||
PLUGIN=$(echo ${{ inputs.repo }} | awk -F/ '{print $NF}')
|
PLUGIN=$(echo ${{ inputs.repo }} | awk -F/ '{print $NF}')
|
||||||
echo "plugin: $PLUGIN"
|
echo "plugin: $PLUGIN"
|
||||||
@@ -94,24 +90,20 @@ jobs:
|
|||||||
|
|
||||||
echo "\`\`\`release-note:change
|
echo "\`\`\`release-note:change
|
||||||
${PLUGIN_TYPE}/${PLUGIN_SERVICE}: Update plugin to ${{ inputs.plugin_tag }}
|
${PLUGIN_TYPE}/${PLUGIN_SERVICE}: Update plugin to ${{ inputs.plugin_tag }}
|
||||||
\`\`\`" > "changelog/${vault_pr_num}.txt"
|
\`\`\`" > "changelog/${{ steps.pr.outputs.vault_pr_num }}.txt"
|
||||||
|
|
||||||
git add .
|
git add changelog/
|
||||||
git commit -m "Add changelog"
|
git commit -m "Add changelog"
|
||||||
git push origin ${{ github.ref_name }}:"$VAULT_BRANCH"
|
git push origin ${{ github.ref_name }}:"$VAULT_BRANCH"
|
||||||
|
|
||||||
- name: Add labels to Vault PR
|
- name: Add labels to Vault PR
|
||||||
|
if: steps.pr.outputs.vault_pr_num != ''
|
||||||
env:
|
env:
|
||||||
# this is a different token to the one we have been using that should
|
# this is a different token to the one we have been using that should
|
||||||
# allow us to add labels
|
# allow us to add labels
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$vault_pr_num" ]; then
|
|
||||||
echo "error: no vault PR found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
gh pr edit "${{ steps.pr.outputs.vault_pr_num }}" \
|
gh pr edit "${{ steps.pr.outputs.vault_pr_num }}" \
|
||||||
--add-label "dependencies" \
|
--add-label "dependencies" \
|
||||||
--repo hashicorp/vault
|
--repo hashicorp/vault
|
||||||
|
|||||||
Reference in New Issue
Block a user