From d53472c56621b57974728b708fc4726369769ac9 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 13 Nov 2024 13:18:39 +0900 Subject: [PATCH] Removing Rekku token as reusable workflow as GitHub is not able to pass the tokens between jobs --- .github/workflows/build_artifacts.yml | 20 +++++++++-------- .github/workflows/generate_rekku_token.yml | 25 ---------------------- .github/workflows/pr_from_upstream.yml | 18 +++++++++------- 3 files changed, 21 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/generate_rekku_token.yml diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 44bec01..d056959 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -22,16 +22,8 @@ env: jobs: - # Generate Rekku Token Job - Generate-Rekku-Token: - uses: RetroDECK/components-template/.github/workflows/generate_rekku_token.yml@main - secrets: - REKKU_PRIVATE_KEY: ${{ secrets.REKKU_PRIVATE_KEY }} - Building-project: runs-on: ubuntu-latest - env: - REKKU_TOKEN: ${{ needs.Generate-Rekku-Token.outputs.rekku_token }} steps: @@ -106,6 +98,16 @@ jobs: id: branch_name run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV + - name: Generate a token for Rekku + if: ${{ github.repository == 'RetroDECK/RetroDECK' }} + id: generate-rekku-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.REKKU_APP_ID }} + private-key: ${{ secrets.REKKU_PRIVATE_KEY }} + repositories: "RetroDECK,Cooker" + owner: "RetroDECK" + - name: Publish the artifacts in a new release uses: ncipollo/release-action@v1 with: @@ -117,4 +119,4 @@ jobs: artifacts: "RetroDECK-Artifact.tar.gz, tree.html, RetroDECK-Artifact.sha" allowUpdates: true makeLatest: true - token: ${{ steps.generate-rekku-token.outputs.token || secrets.TRIGGER_BUILD_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ steps.generate-rekku-token.outputs.token || secrets.TRIGGER_BUILD_TOKEN }} diff --git a/.github/workflows/generate_rekku_token.yml b/.github/workflows/generate_rekku_token.yml deleted file mode 100644 index c66c285..0000000 --- a/.github/workflows/generate_rekku_token.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: "Generate a token for Rekku" - -on: - workflow_call: - secrets: - REKKU_PRIVATE_KEY: - required: false - -jobs: - Generate-a-token-for-Rekku: - runs-on: ubuntu-latest - - outputs: - rekku_token: ${{ steps.generate-rekku-token.outputs.token }} - - steps: - - - name: Generate a token for Rekku - id: generate-rekku-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ vars.REKKU_APP_ID }} - private-key: ${{ secrets.REKKU_PRIVATE_KEY }} - owner: "RetroDECK" - skip-token-revoke: true diff --git a/.github/workflows/pr_from_upstream.yml b/.github/workflows/pr_from_upstream.yml index f6994fa..281f964 100644 --- a/.github/workflows/pr_from_upstream.yml +++ b/.github/workflows/pr_from_upstream.yml @@ -10,16 +10,8 @@ on: jobs: - # Generate Rekku Token Job - Generate-Rekku-Token: - uses: RetroDECK/components-template/.github/workflows/generate_rekku_token.yml@main - secrets: - REKKU_PRIVATE_KEY: ${{ secrets.REKKU_PRIVATE_KEY }} - sync-upstream: runs-on: ubuntu-latest - env: - REKKU_TOKEN: ${{ needs.Generate-Rekku-Token.outputs.rekku_token }} steps: - name: Checkout repository @@ -75,6 +67,16 @@ jobs: echo "GIT_DIFF=$git diff --minimal" >> $GITHUB_ENV + - name: Generate a token for Rekku + if: ${{ github.repository == 'RetroDECK/RetroDECK' }} + id: generate-rekku-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.REKKU_APP_ID }} + private-key: ${{ secrets.REKKU_PRIVATE_KEY }} + repositories: "RetroDECK,Cooker" + owner: "RetroDECK" + - name: Push changes to new branch if: success() uses: ad-m/github-push-action@master