Allow Secrets to be used as Access Tokens #10646

Open
opened 2025-11-02 09:14:09 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @1in1 on GitHub (Apr 13, 2023).

Feature Description

Hi! The specific use case I'm bumping into is that I frequently mirror private GitHub repos to my Gitea instance. I have a single read-only access token for use with Gitea. So I often go through the flow:

  • New Migration
  • GitHub Migration
  • Private repo address in the URL field, then I have to dig up the same Gitea access token each time

In trying to speed this up, I saved the access token as a secret in Gitea. If I'm understanding correctly, this should mean it's usable in Actions. I'd love if this would also work in the Access Token field (and potentially, more widely?). I.e., it would be great if I could just fill in

Access Token: ${{ACCESS_TOKEN_GITEA_GITHUB}}

I've confirmed that this does not currently work at the moment (nor do ${TOKEN}, $TOKEN, or TOKEN). I have no idea if anything like this would currently work on GitHub, as I never use GitHub for this purpose.

I've done my best to look for existing/closed issues on this, and failed to find anything. It may be that I'm misunderstanding something, or that the authors aren't keen for the scope of secrets to be expanded to this; please let me know if there's a better way I should be doing this!

Thanks :)

Screenshots

No response

Originally created by @1in1 on GitHub (Apr 13, 2023). ### Feature Description Hi! The specific use case I'm bumping into is that I frequently mirror private GitHub repos to my Gitea instance. I have a single read-only access token for use with Gitea. So I often go through the flow: - New Migration - GitHub Migration - Private repo address in the URL field, then I have to dig up the _same_ Gitea access token each time In trying to speed this up, I saved the access token as a secret in Gitea. If I'm understanding correctly, this should mean it's usable in Actions. I'd love if this would also work in the Access Token field (and potentially, more widely?). I.e., it would be great if I could just fill in ``` Access Token: ${{ACCESS_TOKEN_GITEA_GITHUB}} ``` I've confirmed that this does not currently work at the moment (nor do `${TOKEN}`, `$TOKEN`, or `TOKEN`). I have no idea if anything like this would currently work on GitHub, as I never use GitHub for this purpose. I've done my best to look for existing/closed issues on this, and failed to find anything. It may be that I'm misunderstanding something, or that the authors aren't keen for the scope of secrets to be expanded to this; please let me know if there's a better way I should be doing this! Thanks :) ### Screenshots _No response_
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 09:14:09 -06:00
Author
Owner

@wolfogre commented on GitHub (Apr 13, 2023):

Have you tried ${{ secrets.ACCESS_TOKEN_GITEA_GITHUB }}? See https://docs.github.com/en/actions/learn-github-actions/contexts#secrets-context

@wolfogre commented on GitHub (Apr 13, 2023): Have you tried `${{ secrets.ACCESS_TOKEN_GITEA_GITHUB }}`? See https://docs.github.com/en/actions/learn-github-actions/contexts#secrets-context
Author
Owner

@1in1 commented on GitHub (Apr 13, 2023):

I hadn't (thank you), but have now; can confirm that ${{ secrets.ACCESS_TOKEN_GITEA_GITHUB }} is not working either.

@1in1 commented on GitHub (Apr 13, 2023): I hadn't (thank you), but have now; can confirm that `${{ secrets.ACCESS_TOKEN_GITEA_GITHUB }}` is not working either.
Author
Owner

@wolfogre commented on GitHub (Apr 13, 2023):

Could you please show me your workflow yaml file and the screenshot of secrets setting page?

@wolfogre commented on GitHub (Apr 13, 2023): Could you please show me your workflow yaml file and the screenshot of secrets setting page?
Author
Owner

@1in1 commented on GitHub (Apr 13, 2023):

So I have no yaml file for this; I suppose what I'm requesting is the ability to use these secrets outside of that context. E.g., if I have a secrets page that looks like this:

image

I would ideally love to be able to use this secret as so:

image

As I say, if there's a better/more obvious approach that already exists, which I should be using, I'm all ears!

@1in1 commented on GitHub (Apr 13, 2023): So I have no yaml file for this; I suppose what I'm requesting is the ability to use these secrets outside of that context. E.g., if I have a secrets page that looks like this: <img width="896" alt="image" src="https://user-images.githubusercontent.com/49785531/231735901-e1193bb2-9979-4de2-bd03-1699e52f77ec.png"> I would ideally love to be able to use this secret as so: <img width="615" alt="image" src="https://user-images.githubusercontent.com/49785531/231736097-aeb57e28-258e-40e1-b6d7-93c34abfec97.png"> As I say, if there's a better/more obvious approach that already exists, which I should be using, I'm all ears!
Author
Owner

@wolfogre commented on GitHub (Apr 13, 2023):

Sorry I misunderstood.

Currently, the secrets are used for Gitea Actions only. So what you need hasn't been supported yet.

@wolfogre commented on GitHub (Apr 13, 2023): Sorry I misunderstood. Currently, the secrets are used for Gitea Actions only. So what you need hasn't been supported yet.
Author
Owner

@1in1 commented on GitHub (Apr 13, 2023):

No problem at all, I appreciate you taking a look!

@1in1 commented on GitHub (Apr 13, 2023): No problem at all, I appreciate you taking a look!
Author
Owner

@sobcz commented on GitHub (May 30, 2024):

This would be really nice to have. I just finished updating 73 mirror repositories one by one, going to settings of each, pasting the same token over and over, and it wasn't fun at all. And unless Gitea comes with better way how to deal with this, I'll have to do this every year, because Gitlab, which is the source, limits token validity to only one year. :(

@sobcz commented on GitHub (May 30, 2024): This would be really nice to have. I just finished updating 73 mirror repositories one by one, going to settings of each, pasting the same token over and over, and it wasn't fun at all. And unless Gitea comes with better way how to deal with this, I'll have to do this every year, because Gitlab, which is the source, limits token validity to only one year. :(
Author
Owner

@dimkadv2 commented on GitHub (Jun 20, 2024):

Hi, are there any plans to do this?

@dimkadv2 commented on GitHub (Jun 20, 2024): Hi, are there any plans to do this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10646