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

cleanup: remove more set-outputs #1194

Merged
merged 10 commits into from
Nov 4, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix comments
Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa committed Nov 4, 2022
commit b5274f5281d30179c0b2e7b16a4c35e3e012c351
4 changes: 2 additions & 2 deletions .github/actions/detect-workflow/main.go
Original file line number Diff line number Diff line change
@@ -157,6 +157,6 @@ func main() {
fmt.Printf("ref:%s\n", ref)

// Output of the Action.
github.SetOutput("repository", repository)
github.SetOutput("ref", ref)
fmt.Println(fmt.Sprintf(`::set-output name=repository::%s`, repository))
fmt.Println(fmt.Sprintf(`::set-output name=ref::%s`, ref))
}
2 changes: 1 addition & 1 deletion .github/workflows/builder_node_slsa3.yml
Original file line number Diff line number Diff line change
@@ -268,7 +268,7 @@ jobs:

# cp output into upper folder to make the tarball accessible to
# next step.
echo 'filename=$TARBALL >> $GITHUB_OUTPUT'
echo "filename=$TARBALL" >> "$GITHUB_OUTPUT"

- name: Upload generated tarball
id: upload
9 changes: 6 additions & 3 deletions github/set_output.go
Original file line number Diff line number Diff line change
@@ -15,21 +15,24 @@
package github

import (
"errors"
"fmt"
"os"
)

// SetOutput writes a name value pair to a file located at GITHUB_OUTPUT.
func SetOutput(name, value string) error {
if filename := os.Getenv("GITHUB_OUTPUT"); filename != "" {
f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0o755)
f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0o666)
if err != nil {
return err
}
if _, err := f.WriteString(name + "=" + value + "\n"); err != nil {
return err
}
return f.Close()
} else {
// TODO(asraa): When set-output is EOL, remove this fallback.
fmt.Println("::set-output name=" + name + "::" + value)
}
return errors.New("file GITHUB_OUTPUT not found")
return nil
}