Skip to content

Update Consul versions #954

Update Consul versions

Update Consul versions #954

name: "Update Consul versions"
on:
schedule:
- cron: '22 2 * * *' # Run once per day, at a randomly chosen time.
jobs:
update-consul-versions:
# Only run on main repository
# Scheduled workflows do not have information about fork status, hence the hardcoded check
if: github.repository == 'G-Research/consuldotnet'
environment: update-consul-versions
runs-on: ubuntu-latest
steps:
- name: Install Step CLI
env:
VERSION: 0.19.0
run: |
curl -sLO https://github.com/smallstep/cli/releases/download/v${VERSION}/step-cli_${VERSION}_amd64.deb
sudo dpkg -i step-cli_${VERSION}_amd64.deb
rm step-cli_${VERSION}_amd64.deb
- name: Create access token
id: token
env:
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
run: |
jwt=$(step crypto jwt sign --key /dev/fd/3 --issuer $APP_ID --expiration $(date -d +5min +%s) --subtle 3<<< $APP_PRIVATE_KEY)
installation_id=$(curl -s -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $jwt" https://api.github.com/app/installations | jq '.[] | select(.account.login == "${{ github.repository_owner }}") | .id')
token=$(curl -s -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer $jwt" https://api.github.com/app/installations/$installation_id/access_tokens | jq -r '.token')
echo "::add-mask::$token"
echo "token=$token" >> $GITHUB_OUTPUT
- name: Install PowerShellForGitHub
shell: pwsh
run: Install-Module -Force PowerShellForGitHub
- name: Update consul versions
uses: technote-space/create-pr-action@v2
with:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
EXECUTE_COMMANDS: pwsh .github/workflows/scripts/update-consul-versions.ps1
COMMIT_MESSAGE: 'Update Consul agent versions used for testing'
COMMIT_NAME: 'Consul.NET CI'
COMMIT_EMAIL: '[email protected]'
PR_BRANCH_PREFIX: 'schedule/'
PR_BRANCH_NAME: 'update-consul-versions'
PR_TITLE: 'Update Consul agent versions used for testing'