Skip to content

Support configuration variables on Gitea Actions #24404

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

Closed
wants to merge 0 commits into from

Conversation

sillyguodong
Copy link
Contributor

@sillyguodong sillyguodong commented Apr 28, 2023

See:

Related to:

Screenshoot

Create Variable:
image

image

Workflow:

  test_vars:
    runs-on: ubuntu-latest
    steps:
      - name: Print Custom Variables
        run: echo "${{ vars.test_key }}"
      - name: Try to print a non-exist var
        run: echo "${{ vars.NON_EXIST_VAR }}"

Actions Log:
image


This PR just implement the org and repo level variables, The Environment level variables have not been implemented.
Because Environment is a module separate from Actions. Maybe it would be better to create a new PR to do it.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 28, 2023
@sillyguodong sillyguodong marked this pull request as draft April 28, 2023 09:55
@silverwind silverwind changed the title WIP: Support configuration varibales on Gitea Actions WIP: Support configuration variables on Gitea Actions Apr 28, 2023
@silverwind silverwind added type/feature Completely new functionality. Can only be merged if feature freeze is not active. topic/gitea-actions related to the actions of Gitea labels Apr 30, 2023
@pull-request-size pull-request-size bot added size/XL and removed size/L labels May 8, 2023
@sillyguodong sillyguodong marked this pull request as ready for review May 8, 2023 07:05
@sillyguodong sillyguodong changed the title WIP: Support configuration variables on Gitea Actions Support configuration variables on Gitea Actions May 8, 2023
@lunny lunny added this to the 1.20.0 milestone May 8, 2023
log.Error("find variables of repo: %d, error: %v", task.Job.Run.RepoID, err)
}

// TODO: Env level
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be fixed in this PR? What did it mean?

Copy link
Contributor Author

@sillyguodong sillyguodong May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment is a separate module. It contains the feature of not only environment level variables but also protection rules and environment level secrets.
So i think the feature of Environment should be completed by a new PR.

Screenshot of environment configuration on github:
image

@sillyguodong
Copy link
Contributor Author

sillyguodong commented May 15, 2023

Sorry for my mistake leads to commits cannot sync to this PR.
And I cereate a new PR to replace this #24724.

silverwind added a commit that referenced this pull request Jun 20, 2023
Co-Author: @silverwind @wxiaoguang 
Replace: #24404

See:
- [defining configuration variables for multiple
workflows](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows)
- [vars
context](https://docs.github.com/en/actions/learn-github-actions/contexts#vars-context)

Related to:
- [x] protocol: https://gitea.com/gitea/actions-proto-def/pulls/7
- [x] act_runner: https://gitea.com/gitea/act_runner/pulls/157
- [x] act: https://gitea.com/gitea/act/pulls/43

#### Screenshoot
Create Variable:

![image](https://user-images.githubusercontent.com/33891828/236758288-032b7f64-44e7-48ea-b07d-de8b8b0e3729.png)


![image](https://user-images.githubusercontent.com/33891828/236758174-5203f64c-1d0e-4737-a5b0-62061dee86f8.png)

Workflow:
```yaml
  test_vars:
    runs-on: ubuntu-latest
    steps:
      - name: Print Custom Variables
        run: echo "${{ vars.test_key }}"
      - name: Try to print a non-exist var
        run: echo "${{ vars.NON_EXIST_VAR }}"
```

Actions Log:

![image](https://user-images.githubusercontent.com/33891828/236759075-af0c5950-368d-4758-a8ac-47a96e43b6e2.png)

---
This PR just implement the org / user (depends on the owner of the
current repository) and repo level variables, The Environment level
variables have not been implemented.
Because
[Environment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#about-environments)
is a module separate from `Actions`. Maybe it would be better to create
a new PR to do it.

---------

Co-authored-by: silverwind <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-authored-by: Giteabot <[email protected]>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/gitea-actions related to the actions of Gitea type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants