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

Add support for app token to acquire GITHUB_TOKEN #219

Merged
merged 1 commit into from
Oct 15, 2024
Merged
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
20 changes: 16 additions & 4 deletions .github/workflows/add_new_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ on:
schedule:
- cron: "0 0 * * 3"


permissions:
contents: write
pull-requests: write


jobs:
generate_and_raise_pr:
runs-on: ubuntu-latest
Expand All @@ -34,11 +32,25 @@ jobs:
python -u workflow_scripts/check-for-new-versions.py
env:
EXCLUDED_VERSIONS: "v20.10.x,v23.0.x,v25.0.x,v26.1.x"

- name: Read App Secrets
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/github/app-credentials appId | APP_ID ;
secret/data/github/repo/${{ github.repository }}/github/app-credentials privateKey | PRIVATE_KEY

- name: Create App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.APP_ID }}
private-key: ${{ env.PRIVATE_KEY }}

- name: check if the PR exist
if: ${{ env.PR_TITLE != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
PR_TITLE: ${{env.PR_TITLE}}
run: |
EXISTING_PR=$(gh pr list --limit 1500 --json title,url | jq --arg title "${PR_TITLE}" -r '.[] | select(.title==$title) | .url')
Expand Down Expand Up @@ -76,7 +88,7 @@ jobs:
id: cpr
env:
SOURCE_BRANCH: ${{ steps.branch.outputs.branch }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
PR_TITLE: ${{env.PR_TITLE}}
PR_BODY: autogenerated PR to add docker ${{env.NEW_VERSIONS}}
run: |
Expand Down